Skip to main content

IntoCallbackAttribute

Trait IntoCallbackAttribute 

Source
pub trait IntoCallbackAttribute {
    // Required method
    fn into_callback_attribute(self) -> AttributeValue;
}
Expand description

Trait for types that can be converted into a callback attribute value.

This allows closures to be passed as custom component props.

Required Methods§

Source

fn into_callback_attribute(self) -> AttributeValue

Converts this value into an AttributeValue, wrapping the callback for use as a component prop.

Implementations on Foreign Types§

Source§

impl IntoCallbackAttribute for Option<NativeEventHandler>

Converts an optional event handler into a callback attribute value.

Re-wraps a Some handler with a generic “callback” event name so that subsequent EventAdapter::into_attribute calls can override it with the correct DOM event type.

Source§

fn into_callback_attribute(self) -> AttributeValue

Converts this optional handler into an AttributeValue::Event or AttributeValue::Text if None.

§Returns
  • AttributeValue - An event attribute value if Some, otherwise an empty text attribute.

Implementors§

Source§

impl IntoCallbackAttribute for NativeEventHandler

Converts an owned event handler into a callback attribute value.

Re-wraps the handler with a generic “callback” event name so that subsequent EventAdapter::into_attribute calls can override it with the correct DOM event type.

Source§

impl<F> IntoCallbackAttribute for F
where F: FnMut(NativeEvent) + 'static,

Converts a closure into a callback attribute value.