Function base64::encode_config_buf [] [src]

pub fn encode_config_buf<T: ?Sized + AsRef<[u8]>>(
    input: &T,
    config: Config,
    buf: &mut String
)

Encode arbitrary octets as base64. Writes into the supplied buffer to avoid allocations.

Example

extern crate base64;

fn main() {
    let mut buf = String::new();
    base64::encode_config_buf(b"hello world~", base64::STANDARD, &mut buf);
    println!("{}", buf);

    buf.clear();
    base64::encode_config_buf(b"hello internet~", base64::URL_SAFE, &mut buf);
    println!("{}", buf);
}