Skip to main content

WeakEventHandlerTarget

Trait WeakEventHandlerTarget 

Source
pub trait WeakEventHandlerTarget<A: WeakEventArgs + ?Sized> {
    // Required method
    fn add_event_handler(
        &self,
        event_name: &str,
        handler: Rc<WeakEventHandler<A>>,
    ) -> Option<Box<dyn FnOnce()>>;
}
Expand description

The events of a type, found by name: what the managed original looks up through reflection on the target type.

Required Methods§

Source

fn add_event_handler( &self, event_name: &str, handler: Rc<WeakEventHandler<A>>, ) -> Option<Box<dyn FnOnce()>>

Adds handler to the event named event_name and returns the action that removes it, or None if the type has no such event.

The action must not hold the target strongly: the target holds the subscription through the handler, and the subscription holds the action.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§