Skip to main content

Module base64

Module base64 

Source
Expand description

Base64 encoding support for human-readable serialization.

This module provides an alternative to the default hex encoding. Use it with #[serde(with = "serde_human_bytes::base64")].

§Example

use serde_derive::{Deserialize, Serialize};

#[derive(Deserialize, Serialize)]
struct Example {
    #[serde(with = "serde_human_bytes::base64")]
    data: Vec<u8>,

    #[serde(with = "serde_human_bytes::base64")]
    byte_buf: serde_human_bytes::ByteBuf,

    #[serde(with = "serde_human_bytes::base64")]
    boxed: Box<[u8]>,
}

Functions§

deserialize
Serde deserialize_with function accepting standard base64.
serialize
Serde serialize_with function emitting standard base64.