[][src]Struct ratelimit_meter::state::direct::Builder

pub struct Builder<P, A> where
    P: Relative,
    A: Algorithm<P> + Sized
{ /* fields omitted */ }

An object that allows incrementally constructing rate Limiter objects.

Methods

impl<P, A> Builder<P, A> where
    P: Relative,
    A: Algorithm<P> + Sized
[src]

pub fn cell_weight(
    &mut self,
    weight: NonZeroU32
) -> Result<&mut Builder<P, A>, InconsistentCapacity>
[src]

Sets the "weight" of each cell being checked against the bucket. Each cell fills the bucket by this much.

pub fn per(&mut self, time_unit: Duration) -> &mut Builder<P, A>[src]

Sets the "unit of time" within which the bucket drains.

The assumption is that in a period of time_unit (if no cells are being checked), the bucket is fully drained.

pub fn build(&self) -> Result<DirectRateLimiter<A, P>, InconsistentCapacity>[src]

Builds a rate limiter of the specified type.

Auto Trait Implementations

impl<P, A> Send for Builder<P, A>

impl<P, A> Sync for Builder<P, A>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T