Function encode
Source pub fn encode(data: impl AsRef<[u8]>, alphabet: Alphabet) -> String
Available on crate feature alloc only.
Expand description
Encodes bytes to a base64 string using the given Alphabet.
ยงExample
let encoded = base64::encode(b"hello world", base64::Alphabet::Standard);
assert_eq!(encoded, "aGVsbG8gd29ybGQ=");