pub fn decode<'a, S>(str: S) -> Result<Vec<u8>, Error>Available on crate feature
alloc only.Expand description
Decodes a Crockford Base32-encoded string.
§Returns
Ok(Vec<u8>): A vector containing the decoded bytes.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 encoded = "1TQ6WBNCMG62S10CSMPWSBD";
// decode string into a vector
let decoded = c32::decode(encoded)?;
let expected = b"usque ad finem";
assert_eq!(&decoded, expected);