Struct citymapper::Client [] [src]

pub struct Client { /* fields omitted */ }

Interface to the CityMapper API

Methods

impl Client
[src]

The main interface for making calls to CityMapper

Returns a future containing the travel time from start coord to end coord as per the citymapper api documented at https://citymapper.3scale.net/docs

Arguments

  • start_coord - The (latitude, longitude) pair to start from
  • end_coord - The (latitude, longitude) pair to start from
  • time_constraint - If specified is an instance of TimeConstraint specifying time constraints on the calculation of the travel time.

Returns

A future which will resolve to the number of minutes to travel.

Example


let start_coord = (51.525246, 0.084672);
let end_coord = (51.559098, 0.074503);
let response_without_time_constraint = client.travel_time(start_coord, end_coord, None);

let time_info = citymapper::TimeConstraint::arrival_by(
    chrono::Utc::now() + chrono::Duration::seconds(1800),
);
let response_with_time_constraint = client.travel_time(start_coord, end_coord, time_info);

Check whether a single (latitude, longitude) pair is covered by citymapper

Arguments

  • coord - The (latitiude, longitude) pair to check for coverage

Returns

A future which resolves to a PointCoverage struct.

Example


let coord = (51.525246, 0.084672);

let response = client.single_point_coverage(coord);

Check whether multiple (latitude, longitude) pairs are covered by citymapper

Arguments

  • points - A set of MultiPointCoverageQuery to check for coverage

Returns

A future which resolves to a Vec<PointCoverage>

Example


let coord = (51.525246, 0.084672);
let point1 = MultiPointCoverageQuery::new(coord, "someid".to_string());
let coord2 = (52.345, 0.0745);
let point2 = MultiPointCoverageQuery::new(coord2, None);

let response = client.coverage(vec![point1, point2]);