Skip to main content

RawFrame

Struct RawFrame 

Source
pub struct RawFrame<'t> { /* private fields */ }
Expand description

A validated, undecoded frame.

Produced by Messager::unpack. The frame has passed all structural and CRC checks, but the payload is still raw bytes.

Use unmarshal to decode the payload into a concrete type, or inspect the fields directly for routing purposes.

§Lifetime

't is tied to the input buffer passed to Messager::unpack. The payload slice borrows from that buffer with no copying.

Implementations§

Source§

impl<'t> RawFrame<'t>

Source

pub fn cmd_id(&self) -> u16

Returns the command ID from the frame header.

Source

pub fn sequence(&self) -> u8

Returns the sequence number from the frame header.

Source

pub fn unmarshal<M: ImplUnMarshal>(&self) -> Result<M, MarshalerError>

Decode the payload into a typed message.

Verifies that the frame’s command ID matches [Marshaler::CMD_ID] and that the payload length matches M::PAYLOAD_SIZE, then delegates to M::unmarshal.

§Errors
Source

pub fn payload(&self) -> &'t [u8]

Returns the raw payload bytes.

The slice borrows directly from the input buffer passed to Messager::unpack. It contains only the payload data — no header, command ID, or CRC.

Trait Implementations§

Source§

impl<'t> Debug for RawFrame<'t>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'t> Freeze for RawFrame<'t>

§

impl<'t> RefUnwindSafe for RawFrame<'t>

§

impl<'t> Send for RawFrame<'t>

§

impl<'t> Sync for RawFrame<'t>

§

impl<'t> Unpin for RawFrame<'t>

§

impl<'t> UnsafeUnpin for RawFrame<'t>

§

impl<'t> UnwindSafe for RawFrame<'t>

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, 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.