Trait EventExt

Source
pub trait EventExt<H, O, A> {
    // Required methods
    fn register<X>(&mut self, handler: X)
       where X: FnMut(&H, A) + Send + 'static;
    fn register_async<X, F>(&mut self, handler: X)
       where X: FnMut(O, A) -> F + Send + 'static,
             F: Future<Output = ()> + 'static;
}

Required Methods§

Source

fn register<X>(&mut self, handler: X)
where X: FnMut(&H, A) + Send + 'static,

Register a closure to be invoked for this event.

Source

fn register_async<X, F>(&mut self, handler: X)
where X: FnMut(O, A) -> F + Send + 'static, F: Future<Output = ()> + 'static,

Register an ‘async closure’ to be invoked for this event.

§Example
my_event.register_async(|args| async move {
    // Do something ...
});

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<H, O, A, T> EventExt<H, O, A> for T
where T: Event<H, O, A>,