Listener

Trait Listener 

Source
pub trait Listener:
    Sized
    + 'static
    + Send {
    type Event: Event;

    // Required method
    fn handle(
        &mut self,
        cancel: &CancellationToken,
        event: Self::Event,
    ) -> impl Future<Output = ()> + Send;
}

Required Associated Types§

Source

type Event: Event

Required Methods§

Source

fn handle( &mut self, cancel: &CancellationToken, event: Self::Event, ) -> impl Future<Output = ()> + Send

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<E, F, Fut> Listener for Many<E, F>
where E: Event, F: Send + FnMut(E) -> Fut + 'static, Fut: Send + Future<Output = ()>,

Source§

type Event = E

Source§

impl<E, F, Fut> Listener for On<E, F>
where E: Event, F: Send + FnMut(E) -> Fut + 'static, Fut: Send + Future<Output = ()>,

Source§

type Event = E

Source§

impl<E, F, Fut> Listener for Once<E, F>
where E: Event, F: Send + FnMut(E) -> Fut + 'static, Fut: Send + Future<Output = ()>,

Source§

type Event = E