pub fn decode<R: Read>(
parser: &mut Parser<R>,
current: Option<ParseResult>,
) -> Option<Value>
Expand description
Given a token parser parser
, will try to decode ParseResult
into
Value
s. This function does obviously not attempt to drain the passed
reader instance, but rather expects one top-level value to parse form.
use bencode_decode::{Parser, decode};
use std::fs::File;
let f = File::open("./test/ubuntu-18.04.4-live-server-amd64.iso.torrent").unwrap();
let mut parser = Parser::new(f);
let res = decode(&mut parser, None).unwrap();