Function vendor_base64::base64::decode
source · pub fn decode(base64_string: &str) -> Result<Vec<u8>, InvalidBase64String>Expand description
Decode base64 string to bytes. Handles padding and no padding.
Examples
use vendor_base64::base64; // Replace vendor_base64 with your project name
// With padding
let string = "cnVzdA==";
let decoded = base64::decode(string).unwrap();
assert_eq!(decoded, [b'r', b'u', b's', b't']);
// Without padding
let string = "cnVzdA";
let decoded = base64::decode(string).unwrap();
assert_eq!(decoded, [b'r', b'u', b's', b't']);