#high-level #api #networking #dc #api-bindings #washington

wmata

wmata is a high level Rust interface to the Washington Metropolitan Area Transit Authority (WMATA) API

12 releases (6 major breaking)

7.1.0 Mar 7, 2020
6.0.0 Dec 29, 2019
5.0.1 Nov 3, 2019
4.0.0 Oct 13, 2019
1.0.0 Oct 4, 2019

#6 in #dc

28 downloads per month

MIT license

175KB
4K SLoC

wmata

wmata is a high level async Rust interface to the Washington Metropolitan Area Transit Authority API.

Contents

Requirements

  • Rust 1.39

Installation

Cargo

wmata = "7.1.0"

Usage

Getting Started

use wmata::{MetroRail, Station};

let client = MetroRail::new(api_key);

let trains = client.next_trains(Station::A01).await?;

Design

wmata breaks the WMATA API into two components: MetroRail and MetroBus.

MetroRail

Provides access to all MetroRail related endpoints.

Using MetroRail
use wmata::{MetroRail, Station};

let client = MetroRail::new(api_key);

let trains = client.next_trains(Station::A01).await?;

MetroBus

Provides access to all MetroBus related endpoints.

Using MetroBus
use wmata::MetroBus;

let client = MetroBus::new(api_key);

let routes = client.routes().await?;

Testing

Note that tests must currently be run with --test-threads 1 in order to pass, due to using live data.

Dependencies

  • serde
  • serde_json
  • reqwest
  • chrono
  • await_trait
  • tokio_test

Contact

Feel free to email questions and comments to emma@emma.sh

License

wmata is released under the MIT license. See LICENSE for details.

Dependencies

~8–13MB
~220K SLoC