maiko/event.rs
1/// Marker trait for events processed by Maiko.
2///
3/// Implement this for your event type (often an enum). Events must be
4/// `Send + Sync + Clone + 'static` because they:
5/// - Are wrapped in `Arc<`[`Envelope<E>`](crate::Envelope)`>` and shared across threads (Sync)
6/// - Cross task boundaries and live in spawned tasks (Send, 'static)
7/// - Are routed to multiple subscribers (Clone)
8///
9/// Use `#[derive(Event)]` instead of implementing this trait manually.
10/// Consider also deriving [`Label`](crate::Label) for human-readable
11/// variant names in diagnostics and test output.
12///
13/// # Example
14///
15/// ```rust
16/// use maiko::Event;
17///
18/// #[derive(Clone, Debug, Event)]
19/// enum ChatEvent {
20/// Message(String),
21/// Join(String),
22/// }
23/// ```
24pub trait Event: Send + Sync + Clone + 'static {}