Skip to main content

encoded_length

Function encoded_length 

Source
pub const fn encoded_length(data_length: usize, padding: bool) -> Option<usize>
Expand description

Encode Returns the size in bytes of the input data after base64 encoding.

Returns None if the output size overflows usize.

ยงExample

assert_eq!(base64::encoded_length(3, true), Some(4));
assert_eq!(base64::encoded_length(1, false), Some(2));
assert_eq!(base64::encoded_length(usize::MAX, true), None);