Skip to main content

EventHandler

Trait EventHandler 

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

Handles converted events synchronously, applying backpressure to consumption.

Handlers run in registration order, with no interleaving across sources. An error stops consumption without acknowledging this transaction. Earlier handlers may already have produced side effects, so retries must tolerate replay. Panics also stop consumption; they do not acknowledge the event.

Required Methods§

Source

fn handle(&self, event: Event<'_>) -> Result<()>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> EventHandler for F
where F: Fn(Event<'_>) -> Result<()> + Send + Sync,