pub struct SerialEncoding;Expand description
DSP0253 byte-stuffing transform. Stateless ZST.
Encode: 0x7E -> [0x7D, 0x5E], 0x7D -> [0x7D, 0x5D], any other
byte -> [b].
Decode: 0x7D 0x5E -> 0x7E, 0x7D 0x5D -> 0x7D, 0x7D <other> ->
InvalidEscape.
Raw 0x7E in the wire stream is NOT rejected here — that’s a
framing concern owned by MctpSerialMedium::deserialize, which
checks the body region for stray flags.
Trait Implementations§
Source§impl BufferEncoding for SerialEncoding
impl BufferEncoding for SerialEncoding
Source§fn write_byte(wire_buf: &mut [u8], byte: u8) -> Result<usize, EncodeError>
fn write_byte(wire_buf: &mut [u8], byte: u8) -> Result<usize, EncodeError>
Encode one logical payload byte into
wire_buf starting at
index 0. Returns the number of wire bytes written (1 for plain,
2 for an escape sequence). The caller advances their write
cursor by the returned count.Source§fn read_byte(wire_buf: &[u8]) -> Result<(u8, usize), DecodeError>
fn read_byte(wire_buf: &[u8]) -> Result<(u8, usize), DecodeError>
Decode the next logical payload byte from
wire_buf starting at
index 0. Returns (decoded_byte, wire_bytes_consumed). The
caller advances their read cursor by wire_bytes_consumed.Source§fn wire_size_of(decoded: &[u8]) -> usize
fn wire_size_of(decoded: &[u8]) -> usize
Wire-byte footprint of
decoded under this encoding. Must equal
the sum of write_byte(_, b) lengths for each b in decoded.
NO default impl: every encoding declares its sizing rule
explicitly.Source§impl Clone for SerialEncoding
impl Clone for SerialEncoding
Source§fn clone(&self) -> SerialEncoding
fn clone(&self) -> SerialEncoding
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SerialEncoding
impl Debug for SerialEncoding
Source§impl Format for SerialEncoding
impl Format for SerialEncoding
Source§impl PartialEq for SerialEncoding
impl PartialEq for SerialEncoding
impl Copy for SerialEncoding
impl Eq for SerialEncoding
impl StructuralPartialEq for SerialEncoding
Auto Trait Implementations§
impl Freeze for SerialEncoding
impl RefUnwindSafe for SerialEncoding
impl Send for SerialEncoding
impl Sync for SerialEncoding
impl Unpin for SerialEncoding
impl UnsafeUnpin for SerialEncoding
impl UnwindSafe for SerialEncoding
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