[][src]Module aliri_core::base64

Wrappers for values that should be serialized or represented as base64

Example

use aliri_core::base64::Base64;

let data = Base64::from_raw("👋 hello, world! 👋".as_bytes());
let enc = data.to_string();
assert_eq!(enc, "8J+RiyBoZWxsbywgd29ybGQhIPCfkYs=");
use aliri_core::base64::{Base64, Base64Url};

let data = Base64Url::from_encoded("8J-RiyBoZWxsbywgd29ybGQhIPCfkYs").unwrap();
assert_eq!(data.as_slice(), "👋 hello, world! 👋".as_bytes());
let transcode = Base64::from_raw(data.into_inner());
let enc = transcode.to_string();
assert_eq!(enc, "8J+RiyBoZWxsbywgd29ybGQhIPCfkYs=");

Structs

Base64

Owned data to be encoded as standard base64

Base64Ref

Borrowed data to be encoded as standard base64

Base64Url

Owned data to be encoded as URL-safe base64 (no padding)

Base64UrlRef

Borrowed data to be encoded as URL-safe base64 (no padding)

InvalidBase64Data

An error while decoding a value which is not properly formatted base64 data