Interactable

Trait Interactable 

Source
pub trait Interactable
where 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§

Source

fn on_click(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static)

Run the given handler when a component is clicked.

Source

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.

Source

fn on_swipe(self: &Rc<Self>, handler: impl Fn(&Rc<Self>, f64, f64) + 'static)

Run the given handler when a component is swiped.

Source

fn on_blur(self: &Rc<Self>, handler: impl Fn(&Rc<Self>) + 'static)

Run the given handler when a component loses focus.

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.

Implementors§