Skip to main content

Module bucket

Module bucket 

Source
Expand description

A token bucket implementation.

Structs§

ClaimedTokens 🔒
A handle to a number of claimed tokens.
InsufficientTokensError 🔒
An operation was attempted to reduce the number of tokens, but the token bucket did not have enough tokens.
TokenBucket 🔒
A token bucket.
TokenBucketConfig 🔒
The refill rate and token max for a TokenBucket.

Enums§

BecameEmpty 🔒
The token bucket transitioned from “non-empty” to “empty”.
BecameNonEmpty 🔒
The token bucket transitioned from “empty” to “non-empty”.
NeverEnoughTokensError 🔒
The token bucket will never have the requested number of tokens.

Traits§

TokenBucketInstant 🔒
Any type implementing this must be represented as a measurement of a monotonically nondecreasing clock.