#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

#2233 in Encoding

Download history 643/week @ 2024-03-24 388/week @ 2024-03-31 235/week @ 2024-04-07 298/week @ 2024-04-14 222/week @ 2024-04-21 429/week @ 2024-04-28 285/week @ 2024-05-05 435/week @ 2024-05-12 311/week @ 2024-05-19 271/week @ 2024-05-26 219/week @ 2024-06-02 675/week @ 2024-06-09 857/week @ 2024-06-16 529/week @ 2024-06-23 638/week @ 2024-06-30 575/week @ 2024-07-07

2,640 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

~335–590KB
~12K SLoC