governor
A rate-limiting implementation in Rust
0.10.4
72M downloads/mo
#981 most downloaded on crates.io
boinkor-net/governor
What this package is like to depend on
Last release 8 months ago
16 Dec 2025
Ships fairly regularly
a new release about every 3 months
Most releases are documented
notes for 21 of 24 stable releases
1 version withdrawn
withdrawn after publishing
7 years old
25 releases · first in 2019
3 releases in the last 12 months
see the full history below
Release timeline
25 releases · Nov 2019 to Dec 2025Releases
latest 25-
0.10.416 Dec 2025Release notes
Open source →Merge pull request #291 from boinkor-net/release/governor/0.10.4
release: governor v0.10.4
Release notes
Open source →Another bug-fix release to repair the documentation build on docs.rs for good: The
doc_auto_cfgfeature was deprecated, this version switches to the featuredoc_cfg. -
0.10.316 Dec 2025Release notes
Open source →Merge pull request #289 from boinkor-net/release/governor/0.10.3
release: governor v0.10.3
Release notes
Open source → -
0.10.213 Nov 2025Release notes
Open source →Merge pull request #283 from boinkor-net/release/governor/0.10.2
release: governor v0.10.2
Release notes
Open source →- Updated the
hashbrowndependency to require version 0.16. Thanks, @cratelyn!
- Updated the
-
0.10.106 Aug 2025Release notes
Open source →Merge pull request #278 from boinkor-net/release/governor/0.10.1
release: governor v0.10.1
-
0.10.027 Mar 2025Release notes
Open source →Merge pull request #267 from boinkor-net/release/governor/0.10.0
release: governor v0.10.0
-
0.9.024 Mar 2025Release notes
Open source →Merge pull request #265 from boinkor-net/release/governor/0.9.0
release: governor v0.9.0
-
0.8.125 Feb 2025Release notes
Open source →Merge pull request #261 from boinkor-net/release/governor/0.8.1
release: governor v0.8.1
-
0.8.010 Dec 2024Release notes
Open source →Merge pull request #253 from boinkor-net/release/governor/0.8.0
release: governor v0.8.0
Release notes
Open source →Changed
-
Fixed the long-standing confusion of rate-limiting "tolerance" vs. "burst capacity": Tolerance is indicated with one cell less than burst capacity would be. The code treated the two as the same thing, leading to spurious single cells being allowed through when the clock advanced. (#107, #249). This confusion has finally been identified and fixed by @jonasmalacofilho in #251.
This should not affect the public API, but any clients subject to rate-limiting may see a slightly fairer treatment.
Contributors
-
-
0.7.021 Oct 2024Release notes
Open source →Merge pull request #248 from boinkor-net/release/governor/0.7.0
release: governor v0.7.0
Release notes
Open source →This is a quick bug-fix release to address the semver incompatibility in 0.6.4. It is functionally identical to 0.6.4, with the exception of the dashmap version upgrade.
Changed
- Upgraded dashmap to 6.1.0.
-
0.6.419 Oct 2024 withdrawnRelease notes
Open source →Merge pull request #243 from boinkor-net/release/governor/0.6.4
release: governor v0.6.4
Release notes
Open source →This release has been yanked because it violates Semantic Versioning ideals: The Clock argument type in functions like
direct_with_clockchanged, which breaks existing code.Instead of 0.6.4, please use 0.7.0.
Added
-
https://docs.rs/governor now lists the features required for feature-gated types and functions.
-
A
RateLimiternow has aclockmethod to retrieve the clock providing its timestamps. Added by @max-heller in #232.
Changed
-
Clocks no longer need to beClone. Changed by @max-heller in #232. -
governor now depends only on
futures-utilandfutures-executorinstead of the much largerfuturescrate. Fixed by @negezor in #239.
-
-
0.6.316 Feb 2024Release notes
Open source →Changed
- Just another bug-fixed release process. This time, it should actually release out of github actions.
-
0.6.116 Feb 2024Release notes
Open source →Changed
-
The governor repo now lives in the
boinkor-netgithub organization. No ownership has changed (@antifuchs still manages this org), but this makes it easier to securely manage the CI and release setup. -
The
.per_secondconstructor forQuotanow constructs a quota that ensures all rate-limiting calls succeed when given values in excess of 1 billion (previously, this would result in rate limiters that would incorrectly reject values). Reported in #203. -
QuantaUpkeepInstantnow properly advances forward. -
no_stdis now properly supported: Instead of parking-lot, governor now uses the spinning_top crate inno_stdmode.
Contributors
-
-
0.6.012 Jul 2023Release notes
Open source →Added
- Type aliases
DefaultDirectRateLimiterandDefaultKeyedRateLimiterto cut down on type-typing of typical rate limiters in struct and function definitions. Requested in #85.
Changed
- The API for
.check_nand.until_n(and their keyed counterpart) have changed to return a nestedResult- the outer indicating whether the check could ever succeed and the inner one indicating the rate limiting result, if it could succeed. - Updated the quanta dependency to
0.11.1.
This change also adds a reference u64 instant to all instances of
the
QuantaUpkeepClockstructure. All lower-resolution quanta timekeeping used by governor will now be relative to that reference instant. - Some parts of the documentation for burst sizes has been rephrased to be less confusing.
Contributors
- Type aliases
-
0.5.129 Nov 2022Release notes
Open source →Changed
- Fixed quota reporting for positive rate limiting decisions when
StateInformationMiddlewareis in use with a real clock. Reported in #157
Contributors
- Fixed quota reporting for positive rate limiting decisions when
-
0.5.019 Sep 2022 -
0.4.209 Feb 2022 -
0.4.121 Jan 2022Release notes
Open source → -
0.4.028 Dec 2021Release notes
Open source →Added
-
You can now alter&expand the information returned from a rate limiter by attaching middleware to it using
.with_middleware::<YourClass>()at construction time.This is an incompatible change, as the type signature of RateLimiter gained an additional generic parameter. See the pull request and issue #66 for details.
Changed
- Updated the
Arcguide section to useArc::clone()instead oflimiter.clone(). - Updated the
quantadependency to 0.8.0, speeding up the quanta clock by a bit. This changes the upkeep clock interface incompatibly: The quanta upkeep Builder structure got renamed toquanta::Upkeep. - The
nanosmodule is now public, allowing other crates to implement theClocktrait. - When using the
stdfeature, governor will no longer pull in thehashbrowncrate.
Contributors
-
-
0.3.228 Jan 2021Nothing published for this version
-
0.3.126 Jul 2020Release notes
Open source →Added
- A little section to the guide explaining how to use keyed rate limiters.
Changed
Several dependencies' minimum versions were bumped, including a version bump of
smallvec, a transitive dependency which could previously result in trees usinggovernorpulling in a vulnerable smallvec version.Contributors
-
0.3.025 Jul 2020Release notes
Open source →Added
- The
ShrinkableKeyedStateStoretrait now has requiredlenandis_emptymethods, which are also made available on anyRateLimiterthat uses a shrinkable (Hashmap / Dashmap backed) state store. Thanks to @lytefast for the idea and pull request onratelimit_meter!
Changed
- The
MonotonicClockandSystemClockstruct definitions now are proper "empty" structs. Any non-Defaultconstruction of these clocks must now useMonotonicClockinstead ofMonotonicClock(). - The
clock::ReasonablyRealtimetrait got simplified and no longer has any required methods to implement, only one default method. - Replaced the
spincrate withparking_lotforno_stdcontexts.
Contributors
- The
-
0.2.001 Mar 2020Release notes
Open source →Added
-
This changelog!
-
New type
RateLimiter, superseding theDirectRateLimitertype. -
Support for keyed rate limiting in
RateLimiter, which allows users to keep a distict rate limit state based on the value of a hashable element. -
Support for different state stores:
-
Support for different clock kinds:
-
Quotaconstructors now support a separate.allow_burstmethod that specifies a maximum burst capacity that diverges from the default. -
New constructor
Quota::with_periodallows specifying the exact amount of time it takes to replenish a single element.
Deprecated
- The
Quota::newconstructor has some very confusing modalities, and should not be used as-is.
Fixed
- An off-by-one error in
check_n, causing calls withn = burst_size + 1to return a "not yet" result instead of a "this will never work" result.
Contributors
-
-
0.1.217 Nov 2019Release notes
Open source →Initial release: A "direct" (a single rate-limiting state per structure) rate limiter that works in an async context, using atomic operations.
-
0.1.115 Nov 2019Nothing published for this version
-
0.1.015 Nov 2019Nothing published for this version