Crates.io | citymapper |
lib.rs | citymapper |
version | 0.1.0 |
source | src |
created_at | 2017-08-20 13:08:11.481842 |
updated_at | 2017-08-20 13:08:11.481842 |
description | A futures aware wrapper around the CityMapper API |
homepage | |
repository | https://github.com/alexjg/citymapper-rs |
max_upload_size | |
id | 28298 |
size | 38,641 |
This is a tiny library wrapping the citymapper API in a futures aware interface.
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.
Licensed under either of
at your option.
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.