amtrak-api 0.2.0

Amtrak Async Rust API Client
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! # Example: Filter Stations
//!
//! This example shows how to filter trains based on the station's state.
use amtrak_api::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    Client::new()
        .stations()
        .await?
        .values()
        .filter(|station| station.state == "PA")
        .for_each(|station| {
            println!("Station \"{}\" is in PA", station.name);
        });

    Ok(())
}