Trait EventHandler

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

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

Event handler trait for processing events

Required Methods§

Source

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

Handle an event

Source

fn name(&self) -> &str

Get handler name for debugging

Source

fn event_types(&self) -> Vec<&'static str>

Get event types this handler is interested in

Provided Methods§

Source

fn is_wildcard(&self) -> bool

Whether this handler should receive all events (wildcard)

Source

fn priority(&self) -> i32

Get handler priority (affects processing order)

Implementors§