pub struct NativeEventHandler { /* private fields */ }Expand description
A wrapper around an event callback.
Stores the event name and a reference-counted mutable closure.
Implementations§
Source§impl NativeEventHandler
Implementation of event handler construction, cloning, and invocation.
impl NativeEventHandler
Implementation of event handler construction, cloning, and invocation.
Sourcepub fn new<F>(event_name: NativeEventName, callback: F) -> Selfwhere
F: FnMut(NativeEvent) + 'static,
pub fn new<F>(event_name: NativeEventName, callback: F) -> Selfwhere
F: FnMut(NativeEvent) + 'static,
Creates a new event handler from an NativeEventName enum and callback.
Sourcepub fn handle(&self, event: NativeEvent)
pub fn handle(&self, event: NativeEvent)
Invokes the underlying callback with the given event.
Source§impl NativeEventHandler
impl NativeEventHandler
pub fn get_event_name(&self) -> &String
pub fn get_mut_event_name(&mut self) -> &mut String
pub fn get_mut_callback(&mut self) -> &mut Rc<RefCell<dyn FnMut(NativeEvent)>>
Trait Implementations§
Source§impl Clone for NativeEventHandler
Clones the event handler, sharing the underlying callback reference.
impl Clone for NativeEventHandler
Clones the event handler, sharing the underlying callback reference.
Source§impl IntoCallbackAttribute for NativeEventHandler
Converts an owned event handler into a callback attribute value.
impl IntoCallbackAttribute for NativeEventHandler
Converts an owned event handler into a callback attribute value.
Source§fn into_callback_attribute(self) -> AttributeValue
fn into_callback_attribute(self) -> AttributeValue
Converts this value into an
AttributeValue, wrapping the callback
for use as a component prop.Source§impl IntoEventAttribute for NativeEventHandler
Converts an owned event handler into an attribute value.
impl IntoEventAttribute for NativeEventHandler
Converts an owned event handler into an attribute value.
Source§fn into_event_attribute(self) -> AttributeValue
fn into_event_attribute(self) -> AttributeValue
Converts this value into an
AttributeValue, or an empty text if None.Auto Trait Implementations§
impl Freeze for NativeEventHandler
impl !RefUnwindSafe for NativeEventHandler
impl !Send for NativeEventHandler
impl !Sync for NativeEventHandler
impl Unpin for NativeEventHandler
impl UnsafeUnpin for NativeEventHandler
impl !UnwindSafe for NativeEventHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more