pub struct MessageEnvelope<P> { /* private fields */ }Expand description
Runtime message envelope that keeps payloads separate from routing metadata.
Implementations§
Source§impl<P> MessageEnvelope<P>
impl<P> MessageEnvelope<P>
Sourcepub const fn new(metadata: MessageMetadata, payload: P) -> Self
pub const fn new(metadata: MessageMetadata, payload: P) -> Self
Create a message envelope.
Sourcepub const fn metadata(&self) -> &MessageMetadata
pub const fn metadata(&self) -> &MessageMetadata
Metadata that travels with the payload.
Sourcepub fn into_payload(self) -> P
pub fn into_payload(self) -> P
Consume the envelope and return the payload.
Sourcepub fn map_payload<Q>(self, f: impl FnOnce(P) -> Q) -> MessageEnvelope<Q>
pub fn map_payload<Q>(self, f: impl FnOnce(P) -> Q) -> MessageEnvelope<Q>
Transform the payload while preserving metadata.
Trait Implementations§
Source§impl<P: Clone> Clone for MessageEnvelope<P>
impl<P: Clone> Clone for MessageEnvelope<P>
Source§fn clone(&self) -> MessageEnvelope<P>
fn clone(&self) -> MessageEnvelope<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P: Debug> Debug for MessageEnvelope<P>
impl<P: Debug> Debug for MessageEnvelope<P>
Source§impl<P: PartialEq> PartialEq for MessageEnvelope<P>
impl<P: PartialEq> PartialEq for MessageEnvelope<P>
Source§fn eq(&self, other: &MessageEnvelope<P>) -> bool
fn eq(&self, other: &MessageEnvelope<P>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<P: Eq> Eq for MessageEnvelope<P>
impl<P> StructuralPartialEq for MessageEnvelope<P>
Auto Trait Implementations§
impl<P> Freeze for MessageEnvelope<P>where
P: Freeze,
impl<P> RefUnwindSafe for MessageEnvelope<P>where
P: RefUnwindSafe,
impl<P> Send for MessageEnvelope<P>where
P: Send,
impl<P> Sync for MessageEnvelope<P>where
P: Sync,
impl<P> Unpin for MessageEnvelope<P>where
P: Unpin,
impl<P> UnsafeUnpin for MessageEnvelope<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for MessageEnvelope<P>where
P: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).