pub const fn max_encoded_len(payload_len: usize) -> usizeExpand description
Returns an output length that is always large enough to hold the SLIP encoding of a
payload of payload_len bytes.
The worst case is a payload made entirely of END or ESC bytes, where every byte
becomes a two-byte escape sequence, plus the one trailing END delimiter.
§Arguments
payload_len- the length of the payload to be encoded.
§Returns
The maximum number of bytes encode can write for that payload.
§Examples
use pamoja_serial::slip;
assert_eq!(slip::max_encoded_len(10), 21);