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.