[−][src]Module lta::async
Async requests for lta-rs
Currently uses futures-preview = "0.3.0-alpha.17"
API calling convention is exactly the same as the sync version
Example
// async prelude includes prelude from sync prelude use lta::r#async::{ prelude::*, lta_client::LTAClient, bus::get_arrival, traffic::get_erp_rates }; use std::env::var; fn async_example(client: <AClient) -> impl Future<Item = (), Error = ()> { type Req = (Vec<ErpRate>, BusArrivalResp); let fut = get_erp_rates(client); let fut2 = get_arrival(client, 83139, "15"); fut.join(fut2) .map(|(a,b): Req| { println!("{:?}", a); println!("{:?}", b); }) .map_err(|e| println!("Request failed ${:?}", e)) } fn multiple_async_requests() { let api_key = var("API_KEY").unwrap(); let client = <AClient::with_api_key(api_key); let fut = async_example(client); run_futures(fut); }
Modules
bus | All API pertaining to buses |
crowd | All API pertaining to transportation crowd |
lta_client | Client for interacting with LTA API |
prelude | Necessary imports to use lts-rs. Prefer this over glob imports |
taxi | All API pertaining to taxis |
traffic | All API pertaining to traffic related data |
train | All API pertaining to train related data |