Trait EventHandler

Source
pub trait EventHandler<E: Event>: Send + Sync {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 E,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn priority(&self) -> i32 { ... }
    fn early(&self) -> bool { ... }
}
Expand description

Event handler trait

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle an event

Provided Methods§

Source

fn priority(&self) -> i32

Handler priority (higher values are called first)

Source

fn early(&self) -> bool

Whether this handler should receive events before others

Implementors§