base64

Function encode_config_buf

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

Encode arbitrary octets as base64. Writes into the supplied output buffer, which will grow the buffer if needed.

ยง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);
}