Skip to main content

NotificationHandler

Trait NotificationHandler 

Source
pub trait NotificationHandler<N: Notification>:
    Send
    + Sync
    + 'static
    + Send {
    type Error: Into<HexeractError> + Send + Sync + 'static;

    // Required method
    fn handle(
        &self,
        notification: N,
        ctx: &HandlerContext,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

Asynchronous handler for a Notification.

Multiple handlers may be registered for the same notification type; the mediator delivers the notification to each of them. A handler failure does not interrupt the fan-out: every registered handler is invoked regardless of sibling outcomes.

Required Associated Types§

Source

type Error: Into<HexeractError> + Send + Sync + 'static

The handler-defined error type, convertible into HexeractError.

Required Methods§

Source

fn handle( &self, notification: N, ctx: &HandlerContext, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Handles the notification.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§