pub fn decode_check<'a, S>(str: S) -> Result<(u8, Vec<u8>), Error>Available on crate features
check and alloc only.Expand description
Decodes a Crockford Base32Check-encoded string.
§Returns
Ok((u8, Vec<u8>)): The version byte and 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::InvalidDataSizewhen data requirements are not met.Error::TryFromIntwhen bit arithmetic operations exceeds bounds.
§Examples
let encoded = "P7AWVHENJJ0RB441K6JVK5DNJ7J3V5";
// decode string with into a vector
let (version, decoded) = c32::decode_check(encoded)?;
let expected = b"usque ad finem";
assert_eq!(decoded, expected);
assert_eq!(version, 22);