lta-rs
🚍 Singapore LTA Datamall async first Rust client. lta-rs is used to interact with lta-datamall
lta-rs in action
Cargo.toml setup
[]
# extra features available: blocking
= { = "0.5.0" }
API key setup
You can get your API key from here
use ;
async
Examples
use ;
// All the APIs in this library are designed to be used like this
// `lta::RequestType::get_something`
// All of them return lta::utils::LTAResult<T>
// The example below is Bus::get_bus_services()
// and Traffic::get_erp_rates()
// Do note that the API calling convention is similar across all the APIs except for
// bus::get_arrival
// Most of the APIs returns only 500 record
// If you want to get records 501 - 1000 take a look at get_erp() example
use ;
async
async
Custom Client
use r#LTAClient;
use ClientBuilder;
use Duration;
use Client;
General advice
- Reuse
LTAClientas it holds a connection pool internally - Reduce the number of times you call the API, take a look at
Update Freqin the documentation and prevent yourself from getting blacklisted. Use a caching mechanism.
Getting help
- You can get help via GitHub issues. I will try my best to respond to your queries :smile:
Design decisions
- Made sure that Rust structs are as close to the original response as possible so 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
Changelog
Changelog can be found here
Requirements
- Rust compiler 1.46
License
lta-rs is licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
Frequently Asked Questions
Is this library being actively developed?
Yes. However, development will slow down from mid August 2019 onwards due to my NS commitments.
What are the APIs available?
Take a look at the official LTA docs.
Where do I get the official docs from lta?
You can get them here