pub struct EncodedMessage<'a> { /* private fields */ }Expand description
Borrowed wire message split into transport-ready chunks.
Implementations§
Source§impl<'a> EncodedMessage<'a>
impl<'a> EncodedMessage<'a>
Sourcepub fn new(
kind: MsgKind,
cid: u32,
control: &'a [u8],
externals: ExternalValues<'a>,
) -> Option<Self>
pub fn new( kind: MsgKind, cid: u32, control: &'a [u8], externals: ExternalValues<'a>, ) -> Option<Self>
Build a message, returning None if its payload exceeds the wire field.
pub fn new_snapshot_cp() -> Self
Sourcepub fn as_buf(&self) -> impl Buf + '_
pub fn as_buf(&self) -> impl Buf + '_
Borrow the complete wire message as a zero-copy byte cursor.
Sourcepub fn chunks(&self) -> impl Iterator<Item = &[u8]> + '_
pub fn chunks(&self) -> impl Iterator<Item = &[u8]> + '_
Iterate over the complete wire message in transmission order.
Sourcepub fn external_chunks(&self) -> impl Iterator<Item = &[u8]> + '_
pub fn external_chunks(&self) -> impl Iterator<Item = &[u8]> + '_
Iterate over external transport chunks in wire order.
Sourcepub const fn external_len(&self) -> usize
pub const fn external_len(&self) -> usize
Total external byte-stream length.
Sourcepub const fn prefix_len(&self) -> usize
pub const fn prefix_len(&self) -> usize
Length of the header and control prefix before external bytes.
Sourcepub const fn payload_len(&self) -> usize
pub const fn payload_len(&self) -> usize
Logical payload length after the header.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for EncodedMessage<'a>
impl<'a> RefUnwindSafe for EncodedMessage<'a>
impl<'a> Send for EncodedMessage<'a>
impl<'a> Sync for EncodedMessage<'a>
impl<'a> Unpin for EncodedMessage<'a>
impl<'a> UnsafeUnpin for EncodedMessage<'a>
impl<'a> UnwindSafe for EncodedMessage<'a>
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