[−][src]Struct ratelimit_meter::state::direct::Builder
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]
C: Clock,
A: Algorithm<C::Instant> + Sized,
pub fn cell_weight(
&mut self,
weight: NonZeroU32
) -> Result<&mut Builder<C, A>, InconsistentCapacity>
[src]
&mut self,
weight: NonZeroU32
) -> Result<&mut Builder<C, A>, InconsistentCapacity>
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,
C: Send,
impl<C, A> Sync for Builder<C, A> where
C: Sync,
C: Sync,
impl<C, A> Unpin for Builder<C, A> where
A: Unpin,
C: Unpin,
A: Unpin,
C: Unpin,
impl<C, A> RefUnwindSafe for Builder<C, A> where
A: RefUnwindSafe,
C: RefUnwindSafe,
A: RefUnwindSafe,
C: RefUnwindSafe,
impl<C, A> UnwindSafe for Builder<C, A> where
A: UnwindSafe,
C: UnwindSafe,
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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Wfn borrow_mut(&mut self) -> &mut T
[src]
ⓘImportant traits for &'_ mut W
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,