ourairports

Rust interface for handling OurAirports data

1 unstable release

0.1.0 Jan 25, 2022

MIT/Apache

46KB
724 lines

ourairports

Rust interface for handling OurAirports data.

Usage

Put ourairports = "0.1" in your Cargo.toml

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Rust interface for handling OurAirports data.

Examples

Retrieving airport data

use ourairports::airports::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let airports = get_airports_csv()?;

    // London Heathrow Airport (ICAO: EGLL, IATA: LHR)
    let heathrow_airport = airports.get(&2434).unwrap();
    assert_eq!(2434, heathrow_airport.id());
    assert_eq!("EGLL", heathrow_airport.ident());
    assert_eq!("LHR", heathrow_airport.iata_code());
    assert_eq!(&AirportType::LargeAirport, heathrow_airport.airport_type());

   Ok(())
}

Credits

The descriptions for many of the fields and enum variants is adapted from the OurAirports data dictionary and map legend.

Dependencies

~8–21MB
~292K SLoC