#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

#2545 in Encoding

Download history 16/week @ 2024-12-04 17/week @ 2024-12-11 40/week @ 2025-01-08 101/week @ 2025-01-15 148/week @ 2025-02-05 7/week @ 2025-02-12 1/week @ 2025-02-19 16/week @ 2025-02-26

172 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.8–2.2MB
~44K SLoC