Function base64::decode_config_buf[][src]

pub fn decode_config_buf<T: ?Sized + AsRef<[u8]>>(
    input: &T,
    config: Config,
    buffer: &mut Vec<u8>
) -> Result<(), DecodeError>

Decode from string reference as octets. Writes into the supplied buffer to avoid allocation. Returns a Result containing an empty tuple, aka ().


extern crate base64;

fn main() {
    let mut buffer = Vec::<u8>::new();
    base64::decode_config_buf("aGVsbG8gd29ybGR+Cg==", base64::STANDARD, &mut buffer).unwrap();
    println!("{:?}", buffer);


    base64::decode_config_buf("aGVsbG8gaW50ZXJuZXR-Cg==", base64::URL_SAFE, &mut buffer)
    println!("{:?}", buffer);