#byte #base64 #serde #b64 #serialize-deserialize

serde_bytes_base64

Wrapper for Vec<u8>, which uses base64 string as serde representation

2 releases

0.1.1 Nov 1, 2021
0.1.0 Oct 31, 2021

#3 in #b64

Download history 352/week @ 2024-07-20 622/week @ 2024-07-27 380/week @ 2024-08-03 559/week @ 2024-08-10 1093/week @ 2024-08-17 678/week @ 2024-08-24 523/week @ 2024-08-31 609/week @ 2024-09-07 390/week @ 2024-09-14 597/week @ 2024-09-21 533/week @ 2024-09-28 355/week @ 2024-10-05 699/week @ 2024-10-12 839/week @ 2024-10-19 462/week @ 2024-10-26 700/week @ 2024-11-02

2,771 downloads per month

MIT license

7KB
63 lines

MIT licensed Version Code Coverage Downloads

serde_bytes_base64

Wrapper for Vec, which uses base64 string as serde representation.

It implements Deserialize, Serialize and Deref to [u8];

Documentation link

Crates.io link

Example

use serde::{Deserialize, Serialize};
use serde_bytes_base64::Bytes;

#[derive(Deserialize, Serialize, Debug)]
struct Val { val: Bytes }

fn main() {
  let result = serde_json::to_string(&Val { val: vec![
      133, 233, 101, 161, 106, 43,
      149, 208, 90, 177, 238, 184,
    ].into() }).unwrap();
  println!("{}", result); // {"val":"helloWorldBase64"}
}

Dependencies

~325–570KB
~12K SLoC