pub trait EventTarget: Widget + Sized {
// Provided methods
fn on_fn(self, code: lv_event_code_t, handler: fn(EventCtx<'_>)) -> Self { ... }
fn on_clicked(self, handler: fn(EventCtx<'_>)) -> Self { ... }
fn on_value_change(self, handler: fn(EventCtx<'_>)) -> Self { ... }
fn on_with<T: Send + Sync + 'static>(
self,
code: lv_event_code_t,
handler: &'static EventHandler<T>,
) -> Self { ... }
fn on_clicked_with<T: Send + Sync + 'static>(
self,
handler: &'static EventHandler<T>,
) -> Self { ... }
fn on_value_change_with<T: Send + Sync + 'static>(
self,
handler: &'static EventHandler<T>,
) -> Self { ... }
}Expand description
Event callback registration. Uses fn pointers for no_std compatibility.
Blanket-implemented for all Widget types.
Provided Methods§
Sourcefn on_fn(self, code: lv_event_code_t, handler: fn(EventCtx<'_>)) -> Self
fn on_fn(self, code: lv_event_code_t, handler: fn(EventCtx<'_>)) -> Self
Register a stateless safe handler for any LVGL event code.
Sourcefn on_clicked(self, handler: fn(EventCtx<'_>)) -> Self
fn on_clicked(self, handler: fn(EventCtx<'_>)) -> Self
Register a stateless safe handler for click events.
Sourcefn on_value_change(self, handler: fn(EventCtx<'_>)) -> Self
fn on_value_change(self, handler: fn(EventCtx<'_>)) -> Self
Register a stateless safe handler for value-changed events.
Sourcefn on_with<T: Send + Sync + 'static>(
self,
code: lv_event_code_t,
handler: &'static EventHandler<T>,
) -> Self
fn on_with<T: Send + Sync + 'static>( self, code: lv_event_code_t, handler: &'static EventHandler<T>, ) -> Self
Register a stateful safe handler — the handler receives the shared
state from the bundled InitCell and an EventCtx.
Sourcefn on_clicked_with<T: Send + Sync + 'static>(
self,
handler: &'static EventHandler<T>,
) -> Self
fn on_clicked_with<T: Send + Sync + 'static>( self, handler: &'static EventHandler<T>, ) -> Self
Stateful click handler (see EventTarget::on_with).
Sourcefn on_value_change_with<T: Send + Sync + 'static>(
self,
handler: &'static EventHandler<T>,
) -> Self
fn on_value_change_with<T: Send + Sync + 'static>( self, handler: &'static EventHandler<T>, ) -> Self
Stateful value-change handler (see EventTarget::on_with).
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.