pub fn encode(source: &[u8], dest: &mut [u8]) -> usize
Expand description
Encodes the source
buffer into the dest
buffer.
This function assumes the typical sentinel value of 0, but does not terminate the encoded message with the sentinel value. This should be done by the caller to ensure proper framing.
§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 crate::max_encoding_length function.