pub fn encode(raw_buffer: &[u8]) -> Result<Vec<u8>, SlipError>Expand description
Encodes data following the SLIP protocol.
Given a buffer of unencoded data, this data will be encoded following
the SLIP protocol, allocated into a new Vec<u8>, and returned
to the calling scope.
ยงExample:
use simple_slip::encode;
let input: Vec<u8> = vec![0x01, 0xDB, 0x49, 0xC0, 0x15];
let expected: Vec<u8> = vec![0xC0, 0x01, 0xDB, 0xDD, 0x49, 0xDB, 0xDC, 0x15, 0xC0];
let result: Vec<u8> = encode(&input).unwrap();
assert_eq!(result, expected);