pub struct Metadata {
pub correlation_id: Option<CorrelationId>,
pub causation_id: Option<CausationId>,
pub trace_id: Option<TraceId>,
pub auth_principal: Option<Principal>,
pub format: Option<FormatTag>,
pub extensions: BTreeMap<String, Value>,
}Expand description
Key-value bag carried on every Message. Holds correlation id,
causation id, trace id, auth principal, format hint, and arbitrary
extension keys.
Fields§
§correlation_id: Option<CorrelationId>Correlation id — links responses to requests.
causation_id: Option<CausationId>Causation id — links events to the command that caused them.
trace_id: Option<TraceId>Trace id for distributed tracing.
auth_principal: Option<Principal>Auth principal.
format: Option<FormatTag>Optional explicit format hint.
extensions: BTreeMap<String, Value>Extension keys. BTreeMap for deterministic iteration and hash.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn with_correlation(self, id: CorrelationId) -> Self
pub fn with_correlation(self, id: CorrelationId) -> Self
Set the correlation id.
Sourcepub fn with_causation(self, id: CausationId) -> Self
pub fn with_causation(self, id: CausationId) -> Self
Set the causation id.
Sourcepub fn with_trace(self, id: TraceId) -> Self
pub fn with_trace(self, id: TraceId) -> Self
Set the trace id.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
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