pub struct FrameAccumulator<const N: usize> { /* private fields */ }Expand description
Byte-by-byte frame accumulator for COBS-framed streams.
Feed raw bytes from the transport via Self::feed. When a 0x00
delimiter is received, Self::frame returns the raw encoded frame
bytes ready for decoding.
N is the internal buffer capacity. Frames that exceed N bytes cause
the accumulator to discard the current frame and set an overflow flag;
Self::frame returns None until Self::reset is called.
Implementations§
Source§impl<const N: usize> FrameAccumulator<N>
impl<const N: usize> FrameAccumulator<N>
Sourcepub fn feed(&mut self, byte: u8) -> bool
pub fn feed(&mut self, byte: u8) -> bool
Feed one byte into the accumulator.
Returns true when a complete frame has been received (i.e., a 0x00
delimiter was just observed). Call Self::frame to get the encoded
bytes, then Self::reset before feeding more data.
Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for FrameAccumulator<N>
impl<const N: usize> RefUnwindSafe for FrameAccumulator<N>
impl<const N: usize> Send for FrameAccumulator<N>
impl<const N: usize> Sync for FrameAccumulator<N>
impl<const N: usize> Unpin for FrameAccumulator<N>
impl<const N: usize> UnsafeUnpin for FrameAccumulator<N>
impl<const N: usize> UnwindSafe for FrameAccumulator<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