codex-percent 0.1.1

Percent Encoding for the 1%
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use codex_percent::FixedEncoder;

fn main() {
    let s = "💩";

    let mut e = FixedEncoder::<12>::init();
    let res = e.encode(s).unwrap();

    assert_eq!(res, 12);
    let t = core::str::from_utf8(e.cur_block().as_slice());

    assert_eq!(t, Ok("%F0%9F%92%A9"));

    println!("{} -> {}", s, t.unwrap());
}