pub struct Deframer<const N: usize> { /* private fields */ }Expand description
Splits a byte stream into COBS blocks on 0x00. A block longer than N
is discarded up to the next delimiter (resync).
Implementations§
Source§impl<const N: usize> Deframer<N>
impl<const N: usize> Deframer<N>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
An empty deframer with an N-byte block buffer. Size N to the
largest COBS block you expect: MAX_FRAME holds any valid frame.
Sourcepub fn push(&mut self, b: u8) -> Push<'_>
pub fn push(&mut self, b: u8) -> Push<'_>
Feed one byte from the stream. On a 0x00 delimiter this returns the
buffered block as Push::Block, or Push::Overflow if the block
outgrew the buffer; an empty block (two delimiters in a row) returns
Push::Pending. Every other byte is buffered and returns
Push::Pending. The returned block borrows the deframer until the
next push.
Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for Deframer<N>
impl<const N: usize> RefUnwindSafe for Deframer<N>
impl<const N: usize> Send for Deframer<N>
impl<const N: usize> Sync for Deframer<N>
impl<const N: usize> Unpin for Deframer<N>
impl<const N: usize> UnsafeUnpin for Deframer<N>
impl<const N: usize> UnwindSafe for Deframer<N>
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