serde_bencoded

Crates.ioserde_bencoded
lib.rsserde_bencoded
version0.3.2
sourcesrc
created_at2020-12-03 12:09:08.007131
updated_at2024-05-07 20:24:23.437786
descriptionYet another encoding/decoding library for bencode
homepage
repositoryhttps://github.com/knightpp/serde_bencoded
max_upload_size
id319267
size98,014
Danylo Kondratiev (knightpp)

documentation

README

crates.io Docs dependency status

Crate for encoding/decoding bencode

What is bencode? It's the encoding mostly used in .torrent files and BitTorrent protocol. For more info see bep_0003.

Quick example

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();
}
Commit count: 45

cargo fmt