Skip to main content

EncodedMessage

Struct EncodedMessage 

Source
pub struct EncodedMessage<'a> { /* private fields */ }
Expand description

Borrowed wire message split into transport-ready chunks.

Implementations§

Source§

impl<'a> EncodedMessage<'a>

Source

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.

Source

pub fn new_snapshot_cp() -> Self

Source

pub fn as_buf(&self) -> impl Buf + '_

Borrow the complete wire message as a zero-copy byte cursor.

Source

pub fn chunks(&self) -> impl Iterator<Item = &[u8]> + '_

Iterate over the complete wire message in transmission order.

Source

pub fn external_chunks(&self) -> impl Iterator<Item = &[u8]> + '_

Iterate over external transport chunks in wire order.

Source

pub const fn header(&self) -> &MsgHeader

Message header.

Source

pub const fn control(&self) -> &[u8] ⓘ

Size-prefixed FlatBuffer control data.

Source

pub const fn external_len(&self) -> usize

Total external byte-stream length.

Source

pub const fn prefix_len(&self) -> usize

Length of the header and control prefix before external bytes.

Source

pub const fn payload_len(&self) -> usize

Logical payload length after the header.

Source

pub const fn total_len(&self) -> usize

Total wire length of all chunks.

Trait Implementations§

Source§

impl<'a> Debug for EncodedMessage<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more