Skip to main content

Event

Trait Event 

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

Marker trait for events processed by Maiko.

Implement this for your event type (often an enum). Events must be Send + Sync + Clone + 'static because they:

  • Are wrapped in Arc<Envelope<E>> and shared across threads (Sync)
  • Cross task boundaries and live in spawned tasks (Send, ’static)
  • Are routed to multiple subscribers (Clone)

The broker wraps events in an Envelope carrying metadata such as sender name and timestamp.

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§