pub trait RateLimitState<P> {
    fn last_touched(&self, params: &P) -> Instant;
}
Expand description

Trait that all rate limit states have to implement around housekeeping in keyed rate limiters.

Required Methods

Returns the last time instant that the state had any relevance (i.e. the rate limiter would behave exactly as if it was a new rate limiter after this time).

If the state has not been touched for a given amount of time, the keyed rate limiter will expire it.

Thread safety

This uses a bucket state snapshot to determine eligibility; race conditions can occur.

Implementations on Foreign Types

Implementors