pub struct Allower {}
Expand description

The most naive implementation of a rate-limiter ever: Always allows every cell through.

Example

use ratelimit_meter::DirectRateLimiter;
use ratelimit_meter::example_algorithms::Allower;
let mut allower = Allower::ratelimiter();
assert!(allower.check().is_ok());

Implementations

Return a rate-limiter that lies, i.e. that allows all requests through.

Trait Implementations

Allows all cells through unconditionally.

The state of a single rate limiting bucket. Read more
The type returned when a rate limiting decision for a single cell is negative. Each rate limiting algorithm can decide to return the type that suits it best, but most algorithms’ decisions also implement NonConformance, to ease handling of how long to wait. Read more
Constructs a rate limiter with the given parameters: capacity is the number of cells to allow, weighing cell_weight, every per_time_unit. Read more
Tests if a single cell can be accommodated in the rate limiter at the instant at and updates the rate-limiter state to account for the weight of the cell. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
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). Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.