Eternity
Eternity is a Rust library to rate limit and optionally cache keyed results.
Two use cases:
- You interact with a REST-API lacking official rate limits and you want to cache frequent requests.
- You have a bot with commands and you want to ratelimit them per user or even globally.
View the examples on how to use this library for these cases.
Example
A basic limiter for endpoints:
use ;
use ;
async
async
All Examples
Here are examples to see what this library can be used for.
Features
There are two features and they are not enabled by default.
cache: Enables functionality to cache values.tokio_0_2: By default this crate supportstokiov1, this feature enablesv0.2support.
Installation
Add the following to your Cargo.toml file:
[]
= "0.1"
Eternity supports a minimum of Rust 1.48.