pub fn encode_engine_string<E: Engine, T: AsRef<[u8]>>(
    input: T,
    output_buf: &mut String,
    engine: &E
)
Expand description

Encode arbitrary octets as base64. Writes into the supplied String, which may allocate if its internal buffer isn’t big enough.

Example

const URL_SAFE_ENGINE: base64::engine::fast_portable::FastPortable =
    base64::engine::fast_portable::FastPortable::from(
        &base64::alphabet::URL_SAFE,
        base64::engine::fast_portable::NO_PAD);
fn main() {
    let mut buf = String::new();
    base64::encode_engine_string(
        b"hello world~",
        &mut buf,
        &base64::engine::DEFAULT_ENGINE);
    println!("{}", buf);

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