Crates.io | serde_bencoded |
lib.rs | serde_bencoded |
version | 0.3.2 |
source | src |
created_at | 2020-12-03 12:09:08.007131 |
updated_at | 2024-05-07 20:24:23.437786 |
description | Yet another encoding/decoding library for bencode |
homepage | |
repository | https://github.com/knightpp/serde_bencoded |
max_upload_size | |
id | 319267 |
size | 98,014 |
What is bencode? It's the encoding mostly used in .torrent
files and BitTorrent protocol.
For more info see bep_0003.
See examples
directory
#[derive(Debug, Serialize, Deserialize)]
struct MetaInfo {
info: Info,
announce: String,
#[serde(rename = "announce-list")]
announce_list: Option<Vec<Vec<String>>>,
#[serde(rename = "creation date")]
creation_date: Option<u64>,
comment: Option<String>,
#[serde(rename = "created by")]
created_by: Option<String>,
encoding: Option<String>,
}
fn main(){
let string = serde_bencoded::to_string(&MetaInfo{...}).unwrap;
let mi: MetaInfo = serde_bencoded::from_str(&string).unwrap();
}