Trait ambient_api::prelude::Editor
source · pub trait Editor {
// Required method
fn editor(
self,
on_change: Arc<CbDebuggable<dyn Fn(Self) + Sync + Send>>,
opts: EditorOpts
) -> Element;
// Provided methods
fn edit_or_view(
self,
on_change: Option<Arc<CbDebuggable<dyn Fn(Self) + Sync + Send>>>,
opts: EditorOpts
) -> Element
where Self: Sized { ... }
fn view(self, opts: EditorOpts) -> Element
where Self: Sized { ... }
}
Expand description
A trait for types that can be edited in the UI.
Implementing this trait allows you to make a UI editor for any value of your type.
Required Methods§
sourcefn editor(
self,
on_change: Arc<CbDebuggable<dyn Fn(Self) + Sync + Send>>,
opts: EditorOpts
) -> Element
fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Self) + Sync + Send>>, opts: EditorOpts ) -> Element
Create an editor Element for this value.
Provided Methods§
sourcefn edit_or_view(
self,
on_change: Option<Arc<CbDebuggable<dyn Fn(Self) + Sync + Send>>>,
opts: EditorOpts
) -> Elementwhere
Self: Sized,
fn edit_or_view(
self,
on_change: Option<Arc<CbDebuggable<dyn Fn(Self) + Sync + Send>>>,
opts: EditorOpts
) -> Elementwhere
Self: Sized,
sourcefn view(self, opts: EditorOpts) -> Elementwhere
Self: Sized,
fn view(self, opts: EditorOpts) -> Elementwhere
Self: Sized,
Viewer for this value.
By default, this will call Editor::editor with a no-op callback.
Object Safety§
This trait is not object safe.