pub struct NativeEventHandler { /* private fields */ }Expand description
A wrapper around an event callback.
Stores the event name and a shared reference to the callback closure.
Uses Rc<UnsafeCell<>> instead of Rc<RefCell<>> to avoid runtime
borrow checking overhead in the single-threaded WASM context.
The Rc provides automatic memory management (freed when last reference drops).
Implementations§
Source§impl NativeEventHandler
Implementation of event handler construction and invocation.
impl NativeEventHandler
Implementation of event handler construction and invocation.
Source§impl NativeEventHandler
impl NativeEventHandler
pub fn get_event_name(&self) -> &'static str
Trait Implementations§
Source§impl Clone for NativeEventHandler
impl Clone for NativeEventHandler
Source§impl Debug for NativeEventHandler
impl Debug for NativeEventHandler
Source§impl From<NativeEventHandler> for AttributeValue
Converts an owned event handler into a callback attribute value.
impl From<NativeEventHandler> for AttributeValue
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§fn from(handler: NativeEventHandler) -> Self
fn from(handler: NativeEventHandler) -> Self
Converts this event handler into an AttributeValue::Event.
§Returns
AttributeValue- An event attribute value with a generic callback event name.
§Arguments
NativeEventHandler- Input value to convert from.
This is the base case of the NativeEventHandler ->
AttrValueAdapter<NativeEventHandler> -> NativeEventHandler
conversion cycle. Calling .into() on the adapter instead would
land back in this impl through the generic
From<AttrValueAdapter<T>> (which unwraps and calls T::into()),
recursing forever.