Skip to content

mchesser/serde_utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serde_utils

Serde helper library

Usage

Add this to your Cargo.toml:

[dependencies]
serde = { version = "1", features = ["derive"]}
serde_utils = { git = "https://github.com/mchesser/serde_utils", features = ["hex", "base64"] }

Then annotate structs using:

#[derive(serde::Serialize, serde::Deserialize)]
struct Data {
    #[serde(with = "serde_utils::hex::u8x6")]
    mac_addr: [u8; 6]

    #[serde(with = "serde_utils::hex::bytes")]
    payload_hex: Vec<u8>

    #[serde(with = "serde_utils::base64::bytes")]
    payload_b64: Vec<u8>

    #[serde(with = "serde_utils::base64::f32")]
    numbers_b64: Vec<f32>
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages