Skip to content

A bencode parser written with nom.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

edg-l/nom-bencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nom_bencode

Version Downloads License Rust Docs

A bencode parser written with nom.

use nom_bencode::Value;

let data = nom_bencode::parse(b"d3:cow3:moo4:spam4:eggse").unwrap();
let v = data.first().unwrap();

if let Value::Dictionary(dict) = v {
    let v = dict.get("cow".as_bytes()).unwrap();

    if let Value::Bytes(data) = v {
        assert_eq!(data, b"moo");
    }

    let v = dict.get("spam".as_bytes()).unwrap();
    if let Value::Bytes(data) = v {
        assert_eq!(data, b"eggs");
    }
}

License: MIT OR Apache-2.0

About

A bencode parser written with nom.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages