[][src]Crate lta

lta

lta-rs is a lta datamall client library written in pure safe rust. lta-rs is used to interact with the lta-datamall

Design Decisions

  • Made sure that Rust structs are as close to the original response as possible to make sure that people can reference the original docs if there are any issues
  • Simple and no additional baggage. Only the client is included. E.g If anyone wants to add concurrency, they have to do it on their own
  • Predictable API usage

Usage

Put this in you Cargo.toml

[dependencies]
lta = "0.3.0-async-preview-5"

Initialise API key

extern crate lta;
use lta::prelude::*;
use lta::traffic::get_erp_rates;
use lta::lta_client::LTAClient;
use lta::Result;

fn main() -> Result<()>{
    let api_key = std::env::var("API_KEY").unwrap();
    let client = LTAClient::with_api_key(api_key);
    let erp_rates: Vec<ErpRate> = get_erp_rates(&client)?;
    println!("{:?}", erp_rates);
    Ok(())
}

Re-exports

pub extern crate chrono;
pub extern crate reqwest;
pub use crate::utils::commons::Error;
pub use crate::utils::commons::Result;

Modules

async

Async requests for lta-rs

bus

All API pertaining to buses

bus_enums

Enums for buses and operators Used for transforming stringly typed data from API to enums

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

utils

Utilities for transforming data and other misc