pub struct SlipDecoder { /* private fields */ }Expand description
Incremental SLIP decoder: feed it received bytes one at a time.
Implementations§
Source§impl SlipDecoder
impl SlipDecoder
Sourcepub const fn new(max_len: usize) -> Self
pub const fn new(max_len: usize) -> Self
Creates a decoder that rejects frames longer than max_len decoded bytes.
Sourcepub fn push(&mut self, byte: u8) -> Result<Option<Vec<u8>>>
pub fn push(&mut self, byte: u8) -> Result<Option<Vec<u8>>>
Feeds one received byte. Returns the decoded frame when byte ends it. Empty
frames (consecutive C0s) are returned as empty vectors for the caller to skip.
§Errors
Error::Protocol for an escape byte followed by anything other than DC or
DD, or for a frame longer than the limit. The partial frame is discarded and
decoding restarts with the next byte.
Trait Implementations§
Source§impl Clone for SlipDecoder
impl Clone for SlipDecoder
Auto Trait Implementations§
impl Forget for SlipDecoder
impl Freeze for SlipDecoder
impl Move for SlipDecoder
impl RefUnwindSafe for SlipDecoder
impl Send for SlipDecoder
impl Sync for SlipDecoder
impl Unpin for SlipDecoder
impl UnsafeUnpin for SlipDecoder
impl UnwindSafe for SlipDecoder
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