Function base64_lib::encode_with_alphabet [] [src]

pub fn encode_with_alphabet(bytes: &Vec<u8>, alphabet: &String) -> String

Returns a base64 encoded string.

Arguments

  • bytes - A Vec with bytes to be encoded.
  • alphabet - A custom alphabet. Contains 64 unique characters.

Example

let input_vector: Vec<u8> = String::from("Hello World").into_bytes();
let alphabet: String = String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");
let result_string: String = base64_lib::encode_with_alphabet(&input_vector, &alphabet);