leb128fmt

Function max_len

Source
pub const fn max_len<const BITS: u32>() -> usize
Expand description

Returns the maximum byte length that is used to encode a value for a given number of BITS.

A value can possibly be encoded with a fewer number of bytes.

§Example

assert_eq!(5, leb128fmt::max_len::<32>());
assert_eq!(10, leb128fmt::max_len::<64>());

assert_eq!(5, leb128fmt::max_len::<33>());