mrt-rs 2.0.1

A library for parsing Multi-Threaded Routing Toolkit (MRT) formatted streams.
Documentation

The mrt-rs crate provides functionality to parse an MRT-formatted streams.

Examples

Reading a MRT file containing BPG messages

use std::fs::File;
use mrt_rs::Record;
use mrt_rs::bgp4mp::BGP4MP;

// Open an MRT-formatted file.
let mut file = File::open("res/bird-mrtdump_bgp").unwrap();

// Keep reading (Header, Record) tuples till the end of the file has been reached.
while let Some((header, record)) = mrt_rs::read(&mut file).unwrap() {
match record {
Record::BGP4MP(x) => match x {
BGP4MP::MESSAGE(y) => println!("{:?}", y),
BGP4MP::MESSAGE_AS4(y) => println!("{:?}", y),
_ => continue,
},
_ => continue,
}
}