pub struct FrameParser { /* private fields */ }Expand description
Streaming frame parser for LD2450 radar data output.
Feed bytes one at a time or in chunks. The parser emits ParseEvent::Frame
for each valid frame found in the byte stream.
This is a zero-allocation state machine suitable for no_std environments.
Implementations§
Source§impl FrameParser
impl FrameParser
pub fn new() -> Self
Sourcepub fn feed(&mut self, byte: u8) -> Option<ParseEvent>
pub fn feed(&mut self, byte: u8) -> Option<ParseEvent>
Feed a single byte to the parser. Returns Some(ParseEvent) if a
complete frame was parsed.
Sourcepub fn feed_slice(&mut self, data: &[u8]) -> Vec<ParseEvent>
pub fn feed_slice(&mut self, data: &[u8]) -> Vec<ParseEvent>
Feed a slice of bytes, collecting all parsed events.
For performance-critical paths, prefer calling feed() in a loop
and handling events inline.
Trait Implementations§
Source§impl Debug for FrameParser
impl Debug for FrameParser
Auto Trait Implementations§
impl Freeze for FrameParser
impl RefUnwindSafe for FrameParser
impl Send for FrameParser
impl Sync for FrameParser
impl Unpin for FrameParser
impl UnsafeUnpin for FrameParser
impl UnwindSafe for FrameParser
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