Function encode

Source
pub fn encode<D: AsRef<[u8]>>(data: D) -> String
Expand description

Encodes given data into Base64.

This function uses the URL-safe and no-padding variant of Base64.

ยงExamples

use pkce_std::encoding::encode;

let data = "Hello, world!";

assert_eq!(encode(data), "SGVsbG8sIHdvcmxkIQ");