pub struct Envelope<E: Event> { /* private fields */ }Expand description
Event plus metadata used by the broker for routing and observability.
event: the user-defined payload implementingEvent.meta:Metadescribing who emitted the event and when. Includesactor_nameand optionalcorrelation_idfor linking related events.
Implementations§
Source§impl<E: Event> Envelope<E>
impl<E: Event> Envelope<E>
Sourcepub fn new(event: E, actor_id: ActorId) -> Self
pub fn new(event: E, actor_id: ActorId) -> Self
Create a new envelope tagging the event with the given actor name.
Sourcepub fn with_correlation(
event: E,
actor_id: ActorId,
correlation_id: EventId,
) -> Self
pub fn with_correlation( event: E, actor_id: ActorId, correlation_id: EventId, ) -> Self
Create a new envelope with an explicit correlation id.
Use this to link child events to a parent or to group related flows.
pub fn meta(&self) -> &Meta
pub fn id(&self) -> EventId
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for Envelope<E>where
E: Freeze,
impl<E> RefUnwindSafe for Envelope<E>where
E: RefUnwindSafe,
impl<E> Send for Envelope<E>
impl<E> Sync for Envelope<E>
impl<E> Unpin for Envelope<E>where
E: Unpin,
impl<E> UnwindSafe for Envelope<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more