#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 56/week @ 2024-10-31 9/week @ 2024-11-07 23/week @ 2024-12-05 10/week @ 2024-12-12 54/week @ 2025-01-09 87/week @ 2025-01-16 5/week @ 2025-01-30 143/week @ 2025-02-06 7/week @ 2025-02-13

155 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–2.2MB
~45K SLoC