Skip to main content

encode

Function encode 

Source
pub fn encode(src: &[u8], dst: &mut [u8]) -> usize
Expand description

Encodes src with basic COBS into dst, returning the number of bytes written.

The output never contains a 0x00 byte, so a 0x00 may be used to delimit encoded packets on the wire. Encoding never fails: any input is encodable, and the empty input encodes to [0x01].

§Panics

Panics if dst is shorter than max_encoded_len(src.len()).