[][src]Struct postcard_cobs::EncoderState

pub struct EncoderState { /* fields omitted */ }

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

IMPORTANT NOTE: When implementing a custom streaming encoder, the EncoderState state machine assumes that the output buffer ALREADY contains a single placeholder byte, and no other bytes. This placeholder byte will be later modified with the first distance to the next header/zero byte.

Methods

impl EncoderState[src]

pub fn push(&mut self, data: u8) -> PushResult[src]

Push a single unencoded byte into the encoder state machine

pub fn finalize(self) -> (usize, u8)[src]

Finalize the encoding process for a single message. The byte at the given index should be replaced with the given value, and the sentinel value (typically 0u8) must be inserted at the current end of the output buffer, serving as a framing byte.

Trait Implementations

impl Default for EncoderState[src]

fn default() -> Self[src]

Create a default initial state representation for a COBS encoder

impl Debug for EncoderState[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.