pub struct LazyMessage {
pub headers: MessageHeaders,
pub properties: MessageProperties,
pub content_type: String,
pub content_encoding: String,
/* private fields */
}Expand description
Lazy-deserialized message
Headers and properties are eagerly deserialized (they’re small), but the body is lazily deserialized only when accessed.
Fields§
§headers: MessageHeadersMessage headers (eagerly deserialized)
properties: MessagePropertiesMessage properties (eagerly deserialized)
content_type: StringContent type
content_encoding: StringContent encoding
Implementations§
Source§impl LazyMessage
impl LazyMessage
Sourcepub fn from_json(data: &[u8]) -> Result<Self, LazyError>
pub fn from_json(data: &[u8]) -> Result<Self, LazyError>
Create a lazy message from JSON bytes
This performs minimal deserialization - only headers and properties are parsed. The body remains in raw form until accessed.
Sourcepub fn is_body_cached(&self) -> bool
pub fn is_body_cached(&self) -> bool
Check if body is already deserialized
Sourcepub fn body(&self) -> Result<Vec<u8>, LazyError>
pub fn body(&self) -> Result<Vec<u8>, LazyError>
Get deserialized body (triggers deserialization if not cached)
Sourcepub fn has_expires(&self) -> bool
pub fn has_expires(&self) -> bool
Check if message has expiration
Sourcepub fn has_parent(&self) -> bool
pub fn has_parent(&self) -> bool
Check if message has parent
Sourcepub fn into_message(self) -> Result<Message, LazyError>
pub fn into_message(self) -> Result<Message, LazyError>
Convert to fully deserialized message
Trait Implementations§
Source§impl Clone for LazyMessage
impl Clone for LazyMessage
Source§fn clone(&self) -> LazyMessage
fn clone(&self) -> LazyMessage
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 moreAuto Trait Implementations§
impl Freeze for LazyMessage
impl RefUnwindSafe for LazyMessage
impl Send for LazyMessage
impl Sync for LazyMessage
impl Unpin for LazyMessage
impl UnwindSafe for LazyMessage
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