pub struct MessageEnvelope {
pub payload: Vec<u8>,
pub causal_context: Option<CausalContext>,
pub timestamp: u64,
pub publisher_id: String,
pub idempotency_key: Option<String>,
}Expand description
Deterministic storage envelope for durable channel messages.
Fields§
§payload: Vec<u8>Opaque message payload bytes.
causal_context: Option<CausalContext>Optional causal metadata.
timestamp: u64Publisher-provided epoch-millisecond timestamp.
publisher_id: StringStable publisher identity.
idempotency_key: Option<String>Optional producer idempotency key.
Implementations§
Source§impl MessageEnvelope
impl MessageEnvelope
Sourcepub fn serialize(&self) -> Result<Vec<u8>, DurabilityError>
pub fn serialize(&self) -> Result<Vec<u8>, DurabilityError>
Serializes the envelope into a canonical binary representation.
§Errors
Returns DurabilityError::EnvelopeError if a field length cannot be
represented in the storage format.
Sourcepub fn deserialize(bytes: &[u8]) -> Result<Self, DurabilityError>
pub fn deserialize(bytes: &[u8]) -> Result<Self, DurabilityError>
Deserializes an envelope previously produced by Self::serialize.
§Errors
Returns DurabilityError::EnvelopeError when bytes are malformed,
truncated, contain invalid UTF-8, or carry trailing data.
Trait Implementations§
Source§impl Clone for MessageEnvelope
impl Clone for MessageEnvelope
Source§fn clone(&self) -> MessageEnvelope
fn clone(&self) -> MessageEnvelope
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 Debug for MessageEnvelope
impl Debug for MessageEnvelope
impl Eq for MessageEnvelope
Source§impl PartialEq for MessageEnvelope
impl PartialEq for MessageEnvelope
Source§fn eq(&self, other: &MessageEnvelope) -> bool
fn eq(&self, other: &MessageEnvelope) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MessageEnvelope
Auto Trait Implementations§
impl Freeze for MessageEnvelope
impl RefUnwindSafe for MessageEnvelope
impl Send for MessageEnvelope
impl Sync for MessageEnvelope
impl Unpin for MessageEnvelope
impl UnsafeUnpin for MessageEnvelope
impl UnwindSafe for MessageEnvelope
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.