pub trait Interactablewhere
Self: Sized,{
// Provided methods
fn on_click(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static) { ... }
fn on_change(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static) { ... }
fn on_swipe(
self: &Rc<Self>,
handler: impl Fn(&Rc<Self>, f64, f64) + 'static,
) { ... }
fn on_blur(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static) { ... }
}Expand description
Components that can have some kind of interaction implement this trait.
For example a Button will implement the on_click function.
Provided Methods§
Sourcefn on_click(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static)
fn on_click(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static)
Run the given handler when a component is clicked.
Sourcefn on_change(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static)
fn on_change(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static)
Run the given handler when a component changes it’s value or state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.