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};
#[tokio::main]
async fn main() -> LTAResult<()> {
let api_key = std::env::var("API_KEY").expect("API_KEY not found!");
let client = LTAClient::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 crate::async::prelude::*;
Modulesยง
Macrosยง
- api_url
- Helper macro to general API URL at compile time
Structsยง
- Bus
- Bus type that implements APIs. Can be either blocking or async
- Crowd
- Crowd type that implements APIs. Can be either blocking or async
- Facility
- Facility type that implements APIs. Can be either blocking or async
- Geo
- Geo type that implements APIs. Can be either blocking or async
- Taxi
- Taxi type that implements APIs. Can be either blocking or async
- Traffic
- Traffic type that implements APIs. Can be either blocking or async
- Train
- Train type that implements APIs. Can be either blocking or async
Enumsยง
- LTAError
- LTAError type, all request using lta-rs returns
Result<T, LTAError>
Traitsยง
- Client
- A
Client
to make requests with TheClient
holds a connection pool internally, so it is advised that you create one and reuse it
Type Aliasesยง
- LTAResult
- Type alias for
Result<T, LTAError>