Function cobs::decode

source ·
pub fn decode(source: &[u8], dest: &mut [u8]) -> Result<usize, ()>
Expand description

Decodes the source buffer into the dest buffer.

This function uses the typical sentinel value of 0.

Failures

This will return Err(()) if there was a decoding error. Otherwise, it will return Ok(n) where n is the length of the decoded message.

Panics

This function will panic if the dest buffer is not large enough for the decoded message. Since an encoded message as always larger than a decoded message, it may be a good idea to make the dest buffer as big as the source buffer.