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

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

Example

extern crate base64;

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

    buffer.clear();

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