#wrapper #api #future #aware #around #interface

citymapper

A futures aware wrapper around the CityMapper API

1 unstable release

Uses old Rust 2015

0.1.0 Aug 20, 2017

#10 in #aware

MIT/Apache

21KB
306 lines

citymapper-rs Build Status Crates.io Docs

This is a tiny library wrapping the citymapper API in a futures aware interface.

Usage

Install the thing

cargo install citymapper

Use the thing

extern crate chrono;
extern crate tokio_core;
extern crate citymapper;
use tokio_core::reactor::Core;

fn main() {
    let api_key = "<your api key>".to_string();
    let start_coord = (51.525246, 0.084672);
    let end_coord = (51.559098, 0.074503);
    let mut core = Core::new().unwrap();
    let handle = core.handle();
    let client = citymapper::ClientBuilder::new(&handle, api_key).build();
    let time_info = citymapper::TimeConstraint::arrival_by(
        chrono::Utc::now() + chrono::Duration::seconds(1800),
    );
    let response_future = client.travel_time(start_coord, end_coord, time_info);
    let response = core.run(response_future).unwrap();
    println!("Response: {:?}", response);
}

See the documentation for more details.

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.

Dependencies

~14–26MB
~395K SLoC