Listener

Trait Listener 

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

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

Required Associated Types§

Source

type Event: Event

Required Methods§

Source

fn begin( &mut self, cancel: &CancellationToken, ) -> impl Future<Output = ()> + Send

Source

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

Source

fn after( &mut self, cancel: &CancellationToken, ) -> 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> Listener for WithTimes<E, F>
where E: Event, F: Listener<Event = E>,

Source§

type Event = E

Source§

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

Source§

type Event = E