[][src]Trait ratelimit_meter::algorithms::RateLimitStateWithClock

pub trait RateLimitStateWithClock<P, I: Absolute>: RateLimitState<P, I> {
    fn last_touched(&self, params: &P) -> I;
}

Trait that all rate limit states implement if there is a real-time clock available.

Required methods

fn last_touched(&self, params: &P) -> I

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.

Loading content...

Implementations on Foreign Types

impl RateLimitStateWithClock<Allower, Always> for ()[src]

Loading content...

Implementors

impl<P: Absolute> RateLimitStateWithClock<GCRA<P>, P> for ratelimit_meter::algorithms::gcra::State<P>[src]

impl<P: Absolute> RateLimitStateWithClock<LeakyBucket<P>, P> for ratelimit_meter::algorithms::leaky_bucket::State<P>[src]

Loading content...