datex2 0.3.0

Unofficial DATEX II implementation in Rust: read, stream and write road traffic and travel information (v3 XML and JSON, including the Mobilithek AFIR profile) as typed data.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use datex2::v3::{self, Publication};
use std::{fs::File, io::BufReader};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let doc = v3::read(BufReader::new(File::open("incidents.xml")?))?;
    for publication in &doc.publications {
        if let Publication::Situation(p) = publication {
            println!("{} situations", p.situation.len());
        }
    }
    for warning in &doc.warnings {
        eprintln!("{warning}");
    }
    Ok(())
}