base64

Function decode_config_slice

Source
pub fn decode_config_slice<T: ?Sized + AsRef<[u8]>>(
    input: &T,
    config: Config,
    output: &mut [u8],
) -> Result<usize, DecodeError>
Expand description

Decode the input into the provided output slice.

This will not write any bytes past exactly what is decoded (no stray garbage bytes at the end).

If you don’t know ahead of time what the decoded length should be, size your buffer with a conservative estimate for the decoded length of an input: 3 bytes of output for every 4 bytes of input, rounded up, or in other words (input_len + 3) / 4 * 3.

If the slice is not large enough, this will panic.