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>
impl<'t> RawFrame<'t>
Sourcepub fn unmarshal<M: ImplUnMarshal>(&self) -> Result<M, MarshalerError>
pub fn unmarshal<M: ImplUnMarshal>(&self) -> Result<M, MarshalerError>
Decode the payload into a typed message.
Verifies that the frame’s command ID matches crate::Marshaler::CMD_ID and that the
payload length matches M::PAYLOAD_SIZE, then delegates to M::unmarshal.
§Errors
MarshalerError::InvalidCmdID— the frame command ID does not matchM.MarshalerError::InvalidDataLength— payload length does not matchM::PAYLOAD_SIZE.- Any error returned by
M::unmarshal.
Sourcepub fn payload(&self) -> &'t [u8]
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§
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> 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