[][src]Enum postcard_cobs::DecoderState

pub enum DecoderState {
    Idle,
    Grab(u8),
    GrabChain(u8),
}

The DecoderState is used to track the current state of a streaming decoder. This struct does not contain the output buffer (or a reference to one), and can be used when streaming the decoded output to a custom data type.

Variants

Idle

State machine has not received any non-zero bytes

Grab(u8)

1-254 bytes, can be header or 00

GrabChain(u8)

255 bytes, will be a header next

Methods

impl DecoderState[src]

pub fn feed(&mut self, data: u8) -> Result<DecodeResult, ()>[src]

Push a single encoded byte into the state machine. If the input was unexpected, such as an early end of a framed message segment, an Error will be returned, and the current associated output buffer contents should be discarded.

If a complete message is indicated, the decoding state machine will automatically reset itself to the Idle state, and may be used to begin decoding another message.

NOTE: Sentinel value must be included in the input to this function for the decoding to complete

Trait Implementations

impl Debug for DecoderState[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.