pub struct Isp1Frame;Expand description
An ISP1 length-prefixed frame.
The wire format is simply [u32 BE length][payload] where
length is the number of payload bytes (not including itself).
Implementations§
Source§impl Isp1Frame
impl Isp1Frame
Sourcepub fn encode(payload: &[u8], buf: &mut [u8]) -> Result<usize, SleError>
pub fn encode(payload: &[u8], buf: &mut [u8]) -> Result<usize, SleError>
Encodes an ISP1 frame by writing the 4-byte length prefix
followed by the payload into buf.
Returns the total number of bytes written (4 + payload.len()).
Sourcepub fn decode_header(buf: &[u8]) -> Result<(usize, usize), SleError>
pub fn decode_header(buf: &[u8]) -> Result<(usize, usize), SleError>
Reads the 4-byte length prefix from buf, returning
the payload length. Does not validate or consume the
payload — the caller should read that many bytes next.
Returns (payload_length, bytes_consumed) where
bytes_consumed is always 4.
Auto Trait Implementations§
impl Freeze for Isp1Frame
impl RefUnwindSafe for Isp1Frame
impl Send for Isp1Frame
impl Sync for Isp1Frame
impl Unpin for Isp1Frame
impl UnsafeUnpin for Isp1Frame
impl UnwindSafe for Isp1Frame
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