[−][src]Struct postcard_cobs::EncoderState
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]
impl Debug for EncoderState
[src]
Auto Trait Implementations
impl Send for EncoderState
impl Sync for EncoderState
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,