pub struct RawMessage { /* private fields */ }Expand description
An owned snapshot of a message as it travels through the framework.
RawMessage is what the runtime hands to type-erased handlers and what test clients return
from assertions. Broker-specific subscribers usually expose a richer
IncomingMessage type that wraps the broker’s native delivery handle.
Implementations§
Source§impl RawMessage
impl RawMessage
Sourcepub fn new(name: impl Into<String>, payload: impl Into<Bytes>) -> Self
pub fn new(name: impl Into<String>, payload: impl Into<Bytes>) -> Self
Constructs a new message for the given name and payload, with no headers.
Sourcepub fn with_headers(self, headers: Headers) -> Self
pub fn with_headers(self, headers: Headers) -> Self
Builder-style setter that replaces the header map.
Sourcepub fn payload_bytes(&self) -> Bytes
pub fn payload_bytes(&self) -> Bytes
Returns a clone of the payload bytes. Cheap because Bytes is reference-counted.
Sourcepub fn headers_mut(&mut self) -> &mut Headers
pub fn headers_mut(&mut self) -> &mut Headers
Returns a mutable reference to the message headers.
Trait Implementations§
Source§impl Clone for RawMessage
impl Clone for RawMessage
Source§fn clone(&self) -> RawMessage
fn clone(&self) -> RawMessage
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 RawMessage
impl Debug for RawMessage
impl Eq for RawMessage
Source§impl PartialEq for RawMessage
impl PartialEq for RawMessage
Source§fn eq(&self, other: &RawMessage) -> bool
fn eq(&self, other: &RawMessage) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RawMessage
Auto Trait Implementations§
impl !Freeze for RawMessage
impl RefUnwindSafe for RawMessage
impl Send for RawMessage
impl Sync for RawMessage
impl Unpin for RawMessage
impl UnsafeUnpin for RawMessage
impl UnwindSafe for RawMessage
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