Skip to main content

IntoEventProp

Trait IntoEventProp 

Source
pub trait IntoEventProp {
    // Required method
    fn into_event_prop(self) -> Option<NativeEventHandler>;
}
Expand description

Trait for converting event-like values into Option<NativeEventHandler>.

Used by the html! macro when generating typed props for component event fields. Supports closures (FnMut(Event) + 'static), NativeEventHandler, and Option<NativeEventHandler> as input types, converting them all into Option<NativeEventHandler> for assignment to typed Props struct fields.

Required Methods§

Source

fn into_event_prop(self) -> Option<NativeEventHandler>

Converts this value into an Option<NativeEventHandler>.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoEventProp for Option<NativeEventHandler>

Converts an Option<NativeEventHandler> into itself.

Source§

fn into_event_prop(self) -> Option<NativeEventHandler>

Returns this optional handler as-is.

§Returns
  • Option<NativeEventHandler> - The same optional handler.

Implementors§

Source§

impl IntoEventProp for NativeEventHandler

Converts an owned NativeEventHandler into Option<NativeEventHandler>.

Source§

impl<F> IntoEventProp for F
where F: FnMut(Event) + 'static,

Converts a FnMut(Event) closure into Option<NativeEventHandler>.

Wraps the closure in a NativeEventHandler with a generic callback event name.