#bencode

sveppa-bencode

A zero dependency bencode library

9 releases

0.2.2 Jan 25, 2021
0.2.1 Jan 25, 2021
0.1.6 Jan 24, 2021

#25 in #bencode

24 downloads per month
Used in sveppa-torrent

Unlicense OR MIT

13KB
188 lines

A zero dependency library to implement parsing the bencode format into a usable Bencode enum.

Each Bencode object can be destructured into its value easily with the methods (as_usize, as_bytes, as_map, as_list, as_string).

Due to the limitations of the rust typing system you are able to call any of these methods on any of the variants of the Bencode enum.

If a destructuring method is called on the improper variant it will return an InvalidVariantMethod error, which will tell you which function was called, and the variant that was passed to it.

test

No runtime deps