EventHandler

Trait EventHandler 

Source
pub trait EventHandler {
    type HandleFuture<'a>: Future<Output = ApplicationResult<()>> + Send + 'a
       where Self: 'a;

    // Required method
    fn handle_event(&self, event: &DomainEvent) -> Self::HandleFuture<'_>;
}
Expand description

Zero-cost event handler trait with stack allocation

Required Associated Types§

Source

type HandleFuture<'a>: Future<Output = ApplicationResult<()>> + Send + 'a where Self: 'a

Required Methods§

Source

fn handle_event(&self, event: &DomainEvent) -> Self::HandleFuture<'_>

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§

Source§

impl EventHandler for LoggingEventHandler

Source§

type HandleFuture<'a> = impl Future<Output = Result<(), ApplicationError>> + Send + 'a where Self: 'a

Source§

impl EventHandler for NoOpEventHandler

Source§

type HandleFuture<'a> = impl Future<Output = Result<(), ApplicationError>> + Send + 'a where Self: 'a