Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler<E: Event + Clone>:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle(&self, event: &E) -> impl Future<Output = HandlerResult> + Send;
}
Expand description

Trait for async struct-based event handlers that hold their own dependencies.

Implementors can use async fn directly without async-trait.

Required Methods§

Source

fn handle(&self, event: &E) -> impl Future<Output = HandlerResult> + 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§