#container #byte #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

#2389 in Encoding

Download history 30/week @ 2024-07-27 12/week @ 2024-08-03 7/week @ 2024-09-07 7/week @ 2024-09-14 14/week @ 2024-09-21 60/week @ 2024-09-28 34/week @ 2024-10-12 9/week @ 2024-10-19 65/week @ 2024-11-02

108 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.3MB
~47K SLoC