Struct postcard_cobs::CobsDecoder [−][src]
pub struct CobsDecoder<'a> { /* fields omitted */ }
Expand description
The CobsDecoder
type is used to decode a stream of bytes to a
given mutable output slice. This is often useful when heap data
structures are not available, or when not all message bytes are
received at a single point in time.
Implementations
Create a new streaming Cobs Decoder. Provide the output buffer for the decoded message to be placed in
Push a single byte into the streaming CobsDecoder. Return values mean:
- Ok(None) - State machine okay, more data needed
- Ok(Some(N)) - A message of N bytes was successfully decoded
- Err(M) - Message decoding failed, and M bytes were written to output
NOTE: Sentinel value must be included in the input to this function for the decoding to complete
Push a slice of bytes into the streaming CobsDecoder. Return values mean:
- Ok(None) - State machine okay, more data needed
- Ok(Some((N, M))) - A message of N bytes was successfully decoded,
using M bytes from
data
(and earlier data) - Err(J) - Message decoding failed, and J bytes were written to output
NOTE: Sentinel value must be included in the input to this function for the decoding to complete