metainfo parsing

This commit is contained in:
2016-12-11 20:28:12 -05:00
parent 634c82f09e
commit 881c1e2b01
6 changed files with 196 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ use std::io::{self, Read};
use std::str;
use magnolia::bencode::*;
use magnolia::metainfo::Metainfo;
fn load_file(path: &str) -> io::Result<()> {
let mut buf = Vec::new();
@@ -13,7 +14,8 @@ fn load_file(path: &str) -> io::Result<()> {
f.read_to_end(&mut buf)?;
let obj = decode(&buf).unwrap();
println!("{:#?}", obj);
let meta = Metainfo::from_bencode(obj);
println!("{:#?}", meta);
Ok(())
}