base64id 0.4.1

Efficiently represent 64, 32 and 16 bit integers as base64url strings
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use base64id::Base64Id;
use serde_json::Result;

#[derive(Base64Id)]
#[base64id(Serialize, Deserialize)]
struct MyId(i32);

fn main() -> Result<()> {
    let id = MyId(897100256);

    println!("{}", serde_json::to_string(&id)?); // "NXip4A"

    Ok(())
}