pub struct FuncAddEventHandler<TTarget, TEventArgs, TToken = Rc<dyn IDisposable>> { /* private fields */ }Expand description
An IAddEventHandler for the event name of sources of type TTarget, from a function
that subscribes a handler and a function that removes it.
TTarget is the handle of the source (Ref<Button>, Rc<Model>). Deviation (DEVIATIONS.md,
Behaviors): the reference removes a handler by delegate identity; a subscription of the port
returns a token (TToken: a routed event handler token, a disposable), which is what remove
takes.
Implementations§
Source§impl<TTarget, TEventArgs, TToken> FuncAddEventHandler<TTarget, TEventArgs, TToken>where
TTarget: Clone + 'static,
TEventArgs: EventArgsValue + 'static,
TToken: 'static,
impl<TTarget, TEventArgs, TToken> FuncAddEventHandler<TTarget, TEventArgs, TToken>where
TTarget: Clone + 'static,
TEventArgs: EventArgsValue + 'static,
TToken: 'static,
Trait Implementations§
Source§impl<TTarget, TEventArgs, TToken> IAddEventHandler for FuncAddEventHandler<TTarget, TEventArgs, TToken>where
TTarget: Clone + 'static,
TEventArgs: EventArgsValue + 'static,
TToken: 'static,
impl<TTarget, TEventArgs, TToken> IAddEventHandler for FuncAddEventHandler<TTarget, TEventArgs, TToken>where
TTarget: Clone + 'static,
TEventArgs: EventArgsValue + 'static,
TToken: 'static,
Source§fn matches(&self, source: &BoxedValue, event_name: &str) -> bool
fn matches(&self, source: &BoxedValue, event_name: &str) -> bool
Checks if the given source object and event name match the criteria for this event
handler.
Source§fn add_handler(
&self,
source: &BoxedValue,
event_name: &str,
handler: AddEventHandlerCallback,
) -> Option<Rc<dyn IDisposable>>
fn add_handler( &self, source: &BoxedValue, event_name: &str, handler: AddEventHandlerCallback, ) -> Option<Rc<dyn IDisposable>>
Registers an event handler for a specific event on the given source object. Disposing the
returned handle removes it;
None when the source or the event does not match.Auto Trait Implementations§
impl<TTarget, TEventArgs, TToken = Rc<dyn IDisposable>> !RefUnwindSafe for FuncAddEventHandler<TTarget, TEventArgs, TToken>
impl<TTarget, TEventArgs, TToken = Rc<dyn IDisposable>> !Send for FuncAddEventHandler<TTarget, TEventArgs, TToken>
impl<TTarget, TEventArgs, TToken = Rc<dyn IDisposable>> !Sync for FuncAddEventHandler<TTarget, TEventArgs, TToken>
impl<TTarget, TEventArgs, TToken = Rc<dyn IDisposable>> !UnwindSafe for FuncAddEventHandler<TTarget, TEventArgs, TToken>
impl<TTarget, TEventArgs, TToken> Freeze for FuncAddEventHandler<TTarget, TEventArgs, TToken>
impl<TTarget, TEventArgs, TToken> Unpin for FuncAddEventHandler<TTarget, TEventArgs, TToken>
impl<TTarget, TEventArgs, TToken> UnsafeUnpin for FuncAddEventHandler<TTarget, TEventArgs, TToken>where
Box<dyn Fn(&TTarget, Rc<dyn Fn(Option<&Rc<dyn AnyValue>>, &TEventArgs)>) -> TToken>: UnsafeUnpin,
Rc<dyn Fn(&TTarget, TToken)>: UnsafeUnpin,
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more