Personally, as a newer rust user, I'm struggling with the lack of examples in this repository, though it works great for parsing.
error[E0532]: expected unit struct/variant or constant, found struct variant `MrtMessage::RIB_IPV4_UNICAST`
--> src/main.rs:26:33
|
26 | MrtMessage::RIB_IPV4_UNICAST => println!("{:?}", entry.message),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `MrtMessage::RIB_IPV4_UNICAST { /* fields */ }`?
help: possible better candidate is found in another module, you can import it into scope
use std::path::Path;
use std::fs::File;
use std::io::BufReader;
use libflate::gzip::Decoder;
use mrt::{MrtFile, MrtSubType, MrtMessage};
use indicatif::ProgressBar;
fn main() {
{
let bar = ProgressBar::new(245);
let p = Path::new("rib_dump");
for entry in p.read_dir().expect("read_dir call failed") {
bar.inc(1);
if let Ok(entry) = entry {
let f = File::open(entry.path()).unwrap();
let decoder = Decoder::new(BufReader::new(f)).unwrap();
let mrtfile = MrtFile::new(decoder);
println!("Beginning to read");
for entry in mrtfile {
match entry.mrt_header.mrt_subtype {
MrtSubType::RIB_IPV4_UNICAST => {
match entry.message {
MrtMessage::RIB_IPV4_UNICAST => println!("{:?}", entry.message),
_ => continue,
}
},
_ => continue,
}
}
}
}
bar.finish();
}
println!("End scope!")
}