Skip to main content

TypedMiddleware

Trait TypedMiddleware 

Source
pub trait TypedMiddleware<E: Event>:
    Send
    + Sync
    + 'static {
    // Required method
    fn process<'a>(
        &'a self,
        event_name: &'static str,
        event: &'a E,
    ) -> impl Future<Output = MiddlewareDecision> + Send + 'a;
}
Expand description

Async middleware scoped to a specific event type E.

This middleware runs only when publishing events of type E.

Required Methods§

Source

fn process<'a>( &'a self, event_name: &'static str, event: &'a E, ) -> impl Future<Output = MiddlewareDecision> + Send + 'a

Inspect a typed event and decide whether to continue or reject.

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§