Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler<E>: Send + Sync
where E: Event,
{ // Required method fn handle(&self, event: &E) -> Result<(), MessengerError>; }
Expand description

Handles one event type. Many handlers may share the same crate::Message::NAME.

Required Methods§

Source

fn handle(&self, event: &E) -> Result<(), MessengerError>

Handles event.

§Errors

Return MessengerError when handling fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§