pub trait Editor {
    // Required method
    fn editor(
        self,
        on_change: Arc<CbDebuggable<dyn Fn(Self) + Sync + Send + 'static>>,
        opts: EditorOpts
    ) -> Element;

    // Provided methods
    fn edit_or_view(
        self,
        on_change: Option<Arc<CbDebuggable<dyn Fn(Self) + Sync + Send + 'static>>>,
        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§

source

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Self) + Sync + Send + 'static>>, opts: EditorOpts ) -> Element

Create an editor Element for this value.

Provided Methods§

source

fn edit_or_view( self, on_change: Option<Arc<CbDebuggable<dyn Fn(Self) + Sync + Send + 'static>>>, opts: EditorOpts ) -> Elementwhere Self: Sized,

Creates an editor Element for this value, or a view Element if on_change is None.

source

fn view(self, opts: EditorOpts) -> Elementwhere Self: Sized,

Viewer for this value.

By default, this will call Editor::editor with a no-op callback.

Implementations on Foreign Types§

source§

impl<T> Editor for Arc<T>where T: 'static + Send + Sync + Clone + Editor,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Arc<T>) + Sync + Send + 'static>>, opts: EditorOpts ) -> Element

source§

impl Editor for i32

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(i32) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

source§

impl<K, V> Editor for HashMap<K, V, RandomState>where K: Editor + Debug + Clone + Default + Hash + PartialEq<K> + Eq + PartialOrd<K> + Ord + Sync + Send + 'static, V: Editor + Debug + Clone + Default + Sync + Send + 'static,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(HashMap<K, V, RandomState>) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

source§

impl Editor for Vec2

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Vec2) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

impl<K, V> Editor for IndexMap<K, V, RandomState>where K: Hash + Eq + Send + Sync + Debug + 'static + Clone + Editor + Default, V: Send + Sync + Debug + 'static + Clone + Editor + Default,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(IndexMap<K, V, RandomState>) + Sync + Send + 'static>>, _opts: EditorOpts ) -> Element

source§

fn view(self, opts: EditorOpts) -> Element

source§

impl Editor for String

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(String) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _opts: EditorOpts) -> Element

source§

impl<T> Editor for Vec<T, Global>where T: Editor + Debug + Clone + Default + Sync + Send + 'static,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Vec<T, Global>) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

source§

impl<T> Editor for Option<T>where T: Default + Editor + 'static,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Option<T>) + Sync + Send + 'static>>, opts: EditorOpts ) -> Element

source§

fn view(self, opts: EditorOpts) -> Elementwhere Option<T>: Sized,

source§

impl Editor for Vec4

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Vec4) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

impl<const C: usize, T> Editor for [T; C]where T: 'static + Clone + Debug + Editor + Send + Sync,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn([T; C]) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

impl Editor for Vec3

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Vec3) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

impl Editor for usize

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(usize) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

source§

impl Editor for ()

source§

fn editor( self, _on_change: Arc<CbDebuggable<dyn Fn(()) + Sync + Send + 'static>>, _opts: EditorOpts ) -> Element

source§

impl<T> Editor for Arc<Mutex<RawMutex, T>>where T: 'static + Send + Sync + Clone + Editor,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Arc<Mutex<RawMutex, T>>) + Sync + Send + 'static>>, opts: EditorOpts ) -> Element

source§

impl Editor for f32

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(f32) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

source§

impl Editor for Duration

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Duration) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Elementwhere Duration: Sized,

source§

impl Editor for SystemTime

source§

fn editor( self, _: Arc<CbDebuggable<dyn Fn(SystemTime) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

impl Editor for u32

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(u32) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

source§

impl<T> Editor for Box<T, Global>where T: Editor + 'static,

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(Box<T, Global>) + Sync + Send + 'static>>, opts: EditorOpts ) -> Element

source§

impl Editor for bool

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(bool) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

source§

impl Editor for u64

source§

fn editor( self, on_change: Arc<CbDebuggable<dyn Fn(u64) + Sync + Send + 'static>>, _: EditorOpts ) -> Element

source§

fn view(self, _: EditorOpts) -> Element

Implementors§