base64

Function decode_config

Source
pub fn decode_config<T: ?Sized + AsRef<[u8]>>(
    input: &T,
    config: Config,
) -> Result<Vec<u8>, DecodeError>
Expand description

Decode from string reference as octets. Returns a Result containing a Vec.

ยงExample

extern crate base64;

fn main() {
    let bytes = base64::decode_config("aGVsbG8gd29ybGR+Cg==", base64::STANDARD).unwrap();
    println!("{:?}", bytes);

    let bytes_url = base64::decode_config("aGVsbG8gaW50ZXJuZXR-Cg==", base64::URL_SAFE).unwrap();
    println!("{:?}", bytes_url);
}