Function cobs::encode

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

Encodes the source buffer into the dest buffer.

This function uses the typical sentinel value of 0. It returns the number of bytes written to in the dest buffer.

Panics

This function will panic if the dest buffer is not large enough for the encoded message. You can calculate the size the dest buffer needs to be with the max_encoding_length function.