Function decode

Source
pub fn decode<'a, S>(str: S) -> Result<Vec<u8>, Error>
where S: Into<Cow<'a, str>>,
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

§Examples

let encoded = "1TQ6WBNCMG62S10CSMPWSBD";

// decode string into a vector
let decoded = c32::decode(encoded)?;

let expected = b"usque ad finem";
assert_eq!(&decoded, expected);