pub fn rzcobs_decode(src: &[u8], dst: &mut [u8]) -> Result<usize, WireError>Expand description
rzCOBS-decode src (without the 0x00 delimiter) into dst.
Returns the number of decoded bytes written to dst.
§Trailing-zero padding
The rzCOBS algorithm works on 7-byte chunks. The last chunk is
zero-padded to 7 bytes, so the returned length may be up to 6 bytes
larger than the original data length. Callers that know the
exact original length should trim; callers passing the result to
postcard::from_bytes can ignore this because postcard silently
discards trailing bytes.
The dst buffer must be at least MAX_FRAME_SIZE bytes to
accommodate the worst-case padded output.
§In-tree implementation
The rzcobs crate v0.1.x does not provide a no_std decode
function, so this implementation follows the same algorithm directly.
The algorithm invariants are covered by the tests in mod tests.