pub fn decode_into<B>(bytes: B, output: &mut [u8]) -> Result<usize, Error>Expand description
Decodes Crockford Base32-encoded bytes into a provided output buffer.
§Returns
Ok(usize): The number of bytes written to the output buffer.Err(Error): If any errors occur during the decoding process.
§Errors
Error::InvalidStringif the input contains non-ASCII characters.Error::InvalidCharif the character is not found inC32_ALPHABET.Error::InvalidBufferSizeif the output buffer is too small.Error::TryFromIntwhen bit arithmetic operations exceeds bounds.
§Examples
let bytes = b"1TQ6WBNCMG62S10CSMPWSBD";
// allocate a buffer with enough capacity
let mut buffer = [0; 32];
// decode bytes into the buffer
let written = c32::decode_into(bytes, &mut buffer)?;
let expected = b"usque ad finem";
assert_eq!(&buffer[..written], expected);