#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 503/week @ 2024-11-18 731/week @ 2024-11-25 574/week @ 2024-12-02 465/week @ 2024-12-09 220/week @ 2024-12-16 127/week @ 2024-12-30 442/week @ 2025-01-06 657/week @ 2025-01-13 760/week @ 2025-01-20 773/week @ 2025-01-27 659/week @ 2025-02-03 466/week @ 2025-02-10 617/week @ 2025-02-17 1027/week @ 2025-02-24 933/week @ 2025-03-03

3,077 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

~330–560KB
~11K SLoC