pub struct ExperienceEventEnvelope {
pub event_id: EventId,
pub occurred_at: Timestamp,
pub tenant_id: Option<TenantId>,
pub correlation_id: Option<CorrelationId>,
pub event: ExperienceEvent,
}Expand description
Append-only event envelope.
The envelope carries stable metadata (ids, timestamps, correlation) and a typed event payload. Implementations store and index envelopes, not raw payloads, to keep provenance queryable without decoding payload JSON.
Fields§
§event_id: EventIdUnique event identifier (ULID/UUID)
occurred_at: TimestampISO 8601 timestamp of occurrence
tenant_id: Option<TenantId>Optional tenant scope
correlation_id: Option<CorrelationId>Correlation ID for chain/run grouping
event: ExperienceEventTyped event payload
Implementations§
Source§impl ExperienceEventEnvelope
impl ExperienceEventEnvelope
Sourcepub fn new(
event_id: impl Into<EventId>,
event: ExperienceEvent,
) -> ExperienceEventEnvelope
pub fn new( event_id: impl Into<EventId>, event: ExperienceEvent, ) -> ExperienceEventEnvelope
Create a new envelope with a placeholder timestamp.
Production systems should call with_timestamp() to set a trusted time.
Sourcepub fn with_tenant(
self,
tenant_id: impl Into<TenantId>,
) -> ExperienceEventEnvelope
pub fn with_tenant( self, tenant_id: impl Into<TenantId>, ) -> ExperienceEventEnvelope
Add a tenant scope.
Sourcepub fn with_correlation(
self,
correlation_id: impl Into<CorrelationId>,
) -> ExperienceEventEnvelope
pub fn with_correlation( self, correlation_id: impl Into<CorrelationId>, ) -> ExperienceEventEnvelope
Add a correlation ID.
Sourcepub fn with_timestamp(
self,
occurred_at: impl Into<Timestamp>,
) -> ExperienceEventEnvelope
pub fn with_timestamp( self, occurred_at: impl Into<Timestamp>, ) -> ExperienceEventEnvelope
Set explicit timestamp (for replay/testing).
Trait Implementations§
Source§impl Clone for ExperienceEventEnvelope
impl Clone for ExperienceEventEnvelope
Source§fn clone(&self) -> ExperienceEventEnvelope
fn clone(&self) -> ExperienceEventEnvelope
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExperienceEventEnvelope
impl Debug for ExperienceEventEnvelope
Source§impl<'de> Deserialize<'de> for ExperienceEventEnvelope
impl<'de> Deserialize<'de> for ExperienceEventEnvelope
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ExperienceEventEnvelope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ExperienceEventEnvelope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ExperienceEventEnvelope
impl Serialize for ExperienceEventEnvelope
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ExperienceEventEnvelope
impl RefUnwindSafe for ExperienceEventEnvelope
impl Send for ExperienceEventEnvelope
impl Sync for ExperienceEventEnvelope
impl Unpin for ExperienceEventEnvelope
impl UnsafeUnpin for ExperienceEventEnvelope
impl UnwindSafe for ExperienceEventEnvelope
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