#byte #base64 #serde #b64

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

#2014 in Encoding

Download history 40/week @ 2023-12-18 1/week @ 2023-12-25 3/week @ 2024-01-01 156/week @ 2024-01-08 206/week @ 2024-01-15 149/week @ 2024-01-22 202/week @ 2024-01-29 114/week @ 2024-02-05 151/week @ 2024-02-12 181/week @ 2024-02-19 131/week @ 2024-02-26 159/week @ 2024-03-04 161/week @ 2024-03-11 396/week @ 2024-03-18 643/week @ 2024-03-25 397/week @ 2024-04-01

1,600 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–590KB
~12K SLoC