encode

Function encode 

Source
pub fn encode<T>(input: T) -> String
where T: AsRef<[u8]>,
Expand description

Encode the input into a base64 string using the standard base64 encoding scheme.

§Arguments

  • input - The input data to encode, which can be any type that implements AsRef<[u8]>.

§Returns

A String containing the base64 encoded representation of the input data.

§Examples

let data = b"Hello, world!";
let encoded = base64::encode(data);
assert_eq!(encoded, "SGVsbG8sIHdvcmxkIQ==");