Macro base64_serde::base64_serde_type [] [src]

macro_rules! base64_serde_type {
    ($typename:ident, $config:expr) => { ... };
    (pub $typename:ident, $config:expr) => { ... };
    (impl_only, $typename:ident, $config:expr) => { ... };
}

Create a type with appropriate serialize and deserialize functions to use with serde when specifying how to serialize a particular field.

If you wanted to use the URL_SAFE_NO_PAD configuration, for instance, then you might have base64_serde_type!(Base64UrlSafeNoPad, URL_SAFE_NO_PAD) in your code to declare the type, and then use #[serde(with = "Base64UrlSafeNoPad")] on a Vec<u8> field that you wished to serialize to base64 or deserialize from base64.

If you want the resulting type to be public, prefix the desired type name with pub, as in:

base64_serde_type!(pub IWillBeAPublicType, URL_SAFE_NO_PAD)