[−][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
Features available: async
, blocking
. If you only need blocking requests, choose blocking vice versa.
[dependencies]
lta = { version = "0.4.0", features = ["async"] }
Initialise API key
use lta::{ utils::{Client, LTAResult}, models::traffic::erp_rates::ErpRate, blocking::{ traffic::get_erp_rates, lta_client::LTAClient } }; fn main() -> LTAResult<()> { 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, None)?; println!("{:?}", erp_rates); Ok(()) }
Re-exports
pub use lta_models as models; |
pub use lta_utils_commons as utils; |
pub use utils::chrono; |
pub use utils::reqwest; |
Modules
prelude | Necessary imports to use lts-rs. |