pub struct Codec { /* private fields */ }Expand description
Frame-level codec for \r-terminated CAT protocol messages.
Buffers incoming bytes and emits complete frames. Handles partial reads gracefully — the radio may send responses in multiple chunks.
Implementations§
Source§impl Codec
impl Codec
Sourcepub fn feed(&mut self, data: &[u8])
pub fn feed(&mut self, data: &[u8])
Appends raw bytes to the internal buffer.
If the buffer would exceed 64 KB, it is truncated to prevent unbounded memory growth.
Sourcepub fn next_frame(&mut self) -> Option<Vec<u8>>
pub fn next_frame(&mut self) -> Option<Vec<u8>>
Extracts the next complete frame from the buffer, if available.
Searches for a \r delimiter, extracts everything before it as a
frame (without the trailing \r), and removes the consumed bytes
from the buffer. Returns None if no complete frame is available.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Codec
impl RefUnwindSafe for Codec
impl Send for Codec
impl Sync for Codec
impl Unpin for Codec
impl UnwindSafe for Codec
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