#byte #container #byte-array #generics

no-std bytekind

Containers for byte arrays that are generic over their serialization format

9 releases

0.2.0 Apr 24, 2023
0.1.7 Feb 22, 2023
0.1.4 Jan 24, 2023

#1374 in Encoding

Download history 1/week @ 2023-12-30 40/week @ 2024-01-13 213/week @ 2024-01-20 140/week @ 2024-01-27 123/week @ 2024-02-03 134/week @ 2024-02-10 187/week @ 2024-02-17 50/week @ 2024-02-24 3/week @ 2024-03-02 4/week @ 2024-03-09 9/week @ 2024-03-16 32/week @ 2024-03-23 6/week @ 2024-03-30 28/week @ 2024-04-06 14/week @ 2024-04-13

80 downloads per month

MIT license

21KB
588 lines

Containers for bytes that encode their serialization format as generics

let json = serde_json::json!([1, 2, 3, 4]);
let bytes: Bytes<Plain> = serde_json::from_value(json).unwrap();
assert_eq!(&bytes, &[1, 2, 3, 4]);

let bytes: Bytes<HexString> = bytes.convert();
let hex_string = serde_json::to_string(&bytes).unwrap();
assert_eq!(hex_string, "\"01020304\"");

Dependencies

~0.9–2MB
~44K SLoC