| Crates.io | throttle-machines |
| lib.rs | throttle-machines |
| version | 0.1.0 |
| created_at | 2025-12-27 22:26:13.043734+00 |
| updated_at | 2025-12-27 22:26:13.043734+00 |
| description | Rate limiting algorithms: GCRA, token bucket, fixed window |
| homepage | |
| repository | https://github.com/seuros/throttle_machines |
| max_upload_size | |
| id | 2007938 |
| size | 16,810 |
High-performance rate limiting algorithms for Rust.
use throttle_machines::gcra;
let result = gcra::check(
0.0, // current TAT (Theoretical Arrival Time)
1.0, // current time
0.1, // emission_interval (period / limit)
0.0, // delay_tolerance (for burst allowance)
);
if result.allowed {
println!("Request allowed, new TAT: {}", result.new_tat);
} else {
println!("Rate limited, retry after: {}s", result.retry_after);
}
This crate is no_std compatible when the std feature is disabled:
[dependencies]
throttle-machines = { version = "0.1", default-features = false }
MIT