Function base64::decode_config

source ·
pub fn decode_config<T: 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);
}