Crate lta

source ·
Expand description

lta-rs

🚍 Singapore LTA Datamall Rust async first client. lta-rs is used to interact with the lta-datamall

lta-rs in action

Cargo.toml setup

[dependencies]
# extra features available: blocking
lta = { version = "0.6.0" }

API key setup

You can get your API key from here

use lta::{LTAResult, LTAClient, Client, Traffic, TrafficRequests, reqwest_async::ReqwestAsync};

#[tokio::main]
async fn main() -> LTAResult<()> {
    let api_key = std::env::var("API_KEY").expect("API_KEY not found!");
    let client = LTAClient::<ReqwestAsync>::with_api_key(api_key)?;
    let erp_rates = Traffic::get_erp_rates(&client, None).await?;
    println!("{:?}", erp_rates);
    Ok(())
}

Re-exports

  • pub use crate::async::LTAClient;
  • pub use lta_models as models;
  • pub use reqwest;
  • pub use ureq;
  • pub use crate::async::prelude::*;

Modules

Structs

  • Bus type that implements APIs. Can be either blocking or async
  • Crowd type that implements APIs. Can be either blocking or async
  • Facility type that implements APIs. Can be either blocking or async
  • Geo type that implements APIs. Can be either blocking or async
  • Taxi type that implements APIs. Can be either blocking or async
  • Traffic type that implements APIs. Can be either blocking or async
  • Train type that implements APIs. Can be either blocking or async

Enums

  • LTAError type, all request using lta-rs returns Result<T, LTAError>

Traits

  • A Client to make requests with The Client holds a connection pool internally, so it is advised that you create one and reuse it

Type Aliases