Registry / utility / governor

governor

JSON →
library0.10.4rscratesunverified

A rate-limiting library for Rust, providing token bucket and other algorithms.

# Cargo.toml [dependencies] governor = "0.10.4"
INSTALL
IMPORT
SIG · GOVERNOR
G
governor
utilityrustv0.10.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RateLimiter
use governor::RateLimiter;

Create a rate limiter allowing 10 requests per second and check a single request.

use governor::{RateLimiter, Quota}; use nonzero_ext::nonzero; let limiter = RateLimiter::direct(Quota::per_second(nonzero!(10u32))); if limiter.check().is_ok() { println!("Allowed"); }
Debug
Known issues
gotchaRequires the `nonzero_ext` crate for ergonomic quota construction.
fix
Add `nonzero_ext` to your dependencies or use `NonZeroU32::new(10).unwrap()`.
affects: *
Upgrade
Version history
0.10.4latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
governor — cargo add governor · libregistry