Serde-based bencode codec for BitTorrent.
Bencode is the serialization format used throughout BitTorrent for .torrent
files, tracker responses, and DHT messages. It has four types:
- Integers:
i42e,i-1e,i0e - Byte strings:
4:spam(length-prefixed) - Lists:
l<values>e - Dictionaries:
d<key><value>...e(keys are byte strings, sorted)
Usage
use ;
use ;
let torrent = Torrent ;
let encoded = to_bytes.unwrap;
let decoded: Torrent = from_bytes.unwrap;
assert_eq!;