Skip to main content

Notification

Trait Notification 

Source
pub trait Notification:
    Send
    + Sync
    + Clone
    + 'static { }
Expand description

Marker trait for messages announcing that something happened, with fan-out semantics: zero or more handlers may react to the same notification.

Unlike crate::Command and crate::Query, a notification has no output and is not expected to be answered. It is broadcast to every handler registered for its type.

Clone is required because the mediator delivers an independent copy of the value to each registered handler.

§Example

use hexeract_core::Notification;

#[derive(Clone)]
struct OrderShipped {
    pub order_id: uuid::Uuid,
}

impl Notification for OrderShipped {}

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§