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

pub struct Builder<C, A> where
    C: Clock,
    A: Algorithm<C::Instant> + Sized
{ /* fields omitted */ }

An object that allows incrementally constructing rate Limiter objects.

Methods

impl<C, A> Builder<C, A> where
    C: Clock,
    A: Algorithm<C::Instant> + Sized
[src]

pub fn cell_weight(
    &mut self,
    weight: NonZeroU32
) -> Result<&mut Builder<C, 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<C, 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 using_clock(&mut self, clock: C) -> &mut Builder<C, A>[src]

Sets the clock used by the bucket.

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

Builds a rate limiter of the specified type.

Auto Trait Implementations

impl<C, A> Send for Builder<C, A> where
    C: Send

impl<C, A> Sync for Builder<C, A> where
    C: Sync

impl<C, A> Unpin for Builder<C, A> where
    A: Unpin,
    C: Unpin

impl<C, A> RefUnwindSafe for Builder<C, A> where
    A: RefUnwindSafe,
    C: RefUnwindSafe

impl<C, A> UnwindSafe for Builder<C, A> where
    A: UnwindSafe,
    C: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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> Borrow<T> for T where
    T: ?Sized
[src]

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

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