pub struct Decoder { /* private fields */ }Expand description
Streaming HDLC frame decoder.
Accumulates bytes via feed() and yields complete decoded frames.
Matches the decode loop in TCPInterface.py:381-394.
Implementations§
Source§impl Decoder
impl Decoder
pub fn new() -> Self
Sourcepub fn with_min_frame_size(min_frame_size: usize) -> Self
pub fn with_min_frame_size(min_frame_size: usize) -> Self
Construct a decoder for protocols with a different minimum frame size.
pub fn with_limits(min_frame_size: usize, max_buffer_size: usize) -> Self
Sourcepub fn reticulum(hardware_mtu: usize, ifac_size: usize) -> Self
pub fn reticulum(hardware_mtu: usize, ifac_size: usize) -> Self
Construct a decoder with Reticulum’s TCP-style frame bounds.
Decoded frames must be strictly larger than HEADER_MINSIZE and no
larger than the interface hardware MTU plus on-wire IFAC bytes. The
unterminated encoded tail is retained up to twice the hardware MTU.
Sourcepub fn feed(&mut self, chunk: &[u8]) -> Vec<Vec<u8>>
pub fn feed(&mut self, chunk: &[u8]) -> Vec<Vec<u8>>
Feed raw bytes into the decoder and return any complete frames.
Sourcepub fn feed_with_diagnostics(&mut self, chunk: &[u8]) -> DecodeBatch
pub fn feed_with_diagnostics(&mut self, chunk: &[u8]) -> DecodeBatch
Feed raw bytes and retain the decoded lengths of non-empty frames that were rejected by the configured minimum or maximum.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnsafeUnpin for Decoder
impl UnwindSafe for Decoder
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
Source§impl<T> InterfaceConfigData for Twhere
T: Send + 'static,
impl<T> InterfaceConfigData for Twhere
T: Send + 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more