pub struct AssembledMessage { /* private fields */ }Expand description
Container for a fully assembled message.
Preserves EnvelopeRouting from the first frame so that completed
messages are dispatched to the correct handler and logged under the
original correlation identifier.
§Examples
use wireframe::message_assembler::{
AssembledMessage,
CorrelationId,
EnvelopeId,
EnvelopeRouting,
MessageKey,
};
// Normally obtained from MessageAssemblyState::accept_first_frame or
// accept_continuation_frame when a message completes.
let routing = EnvelopeRouting {
envelope_id: EnvelopeId(42),
correlation_id: Some(CorrelationId(7)),
};
let msg = AssembledMessage::new(MessageKey(1), routing, vec![0x01], vec![0x02, 0x03]);
assert_eq!(msg.message_key(), MessageKey(1));
assert_eq!(msg.routing().envelope_id, EnvelopeId(42));
assert_eq!(msg.routing().correlation_id, Some(CorrelationId(7)));
assert_eq!(msg.metadata(), &[0x01]);
assert_eq!(msg.body(), &[0x02, 0x03]);Implementations§
Source§impl AssembledMessage
impl AssembledMessage
Sourcepub fn new(
message_key: MessageKey,
routing: EnvelopeRouting,
metadata: Vec<u8>,
body: Vec<u8>,
) -> Self
pub fn new( message_key: MessageKey, routing: EnvelopeRouting, metadata: Vec<u8>, body: Vec<u8>, ) -> Self
Create a new assembled message.
Sourcepub const fn message_key(&self) -> MessageKey
pub const fn message_key(&self) -> MessageKey
Message key that correlated the frames.
Sourcepub const fn routing(&self) -> EnvelopeRouting
pub const fn routing(&self) -> EnvelopeRouting
Envelope routing metadata from the first frame.
Trait Implementations§
Source§impl Clone for AssembledMessage
impl Clone for AssembledMessage
Source§fn clone(&self) -> AssembledMessage
fn clone(&self) -> AssembledMessage
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 AssembledMessage
impl Debug for AssembledMessage
Source§impl PartialEq for AssembledMessage
impl PartialEq for AssembledMessage
impl Eq for AssembledMessage
impl StructuralPartialEq for AssembledMessage
Auto Trait Implementations§
impl Freeze for AssembledMessage
impl RefUnwindSafe for AssembledMessage
impl Send for AssembledMessage
impl Sync for AssembledMessage
impl Unpin for AssembledMessage
impl UnsafeUnpin for AssembledMessage
impl UnwindSafe for AssembledMessage
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