Crate citymapper [] [src]

A library for using the CityMapper API

This library wraps the citymapper in a futures aware rust interface

E.g

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);
}

As you can see you first need to instantiate a ClientBuilder and use that to create an instance of Client.

Modules

errors

Structs

Client

Interface to the CityMapper API

ClientBuilder

Interface for building a citymapper client

MultiPointCoverageQuery

An individual point to send to the multi point coverage query API

PointCoverage

One point in a response from the coverage API (either single or multi point)

TimeConstraint

The citymapper travel time API accepts an optional time argument which specifies when you want the travel time to be calculated for. This struct represents that argument.