Crate burster

Crate burster 

Source
Expand description

§Burster

Burster is a lightweigh crate providing stack allocated rate limiters with minimal dependencies.

§Available limiters

§Platform support

On std targets you are all good to go and can use the following utility functions for instantiating the limiters:

On no_std targets you’ll have to provide bindings to your platforms timing functionalities and use the constructor methods:

You must provide timer access in the form of a closuse that returns current system timestamp as a core::time::Duration from some fixed epoch in the past. It’s a bit silly, but we use Duration instead of Instant because Instant requires std.

Structs§

CantConsume
Error type indicating that the requested amount of tokens cannot be consumed from the limiter.
FixedWindow
Fixed window -type rate limiter
SlidingWindowCounter
Sliding window counter -type rate limiter
SlidingWindowLog
Sliding window log -type rate limiter
TokenBucket
Token bucket -type rate limiter

Traits§

Limiter
Common trait for all rate limiter implementations

Functions§

fixed_window
Build a fixed window limiter
sliding_window_counter
Build a sliding window counter limiter
sliding_window_log
Build a sliding window limiter
token_bucket
Build a token bucket limiter

Type Aliases§

LimiterResult
Limiter consume action result type