[−][src]Struct ratelimit_meter::state::direct::Builder
An object that allows incrementally constructing rate Limiter objects.
Methods
impl<P, A> Builder<P, A> where
P: Relative,
A: Algorithm<P> + Sized,
[src]
P: Relative,
A: Algorithm<P> + Sized,
pub fn cell_weight(
&mut self,
weight: NonZeroU32
) -> Result<&mut Builder<P, A>, InconsistentCapacity>
[src]
&mut self,
weight: NonZeroU32
) -> Result<&mut Builder<P, 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<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
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Rfn borrow_mut(&mut self) -> &mut T
[src]
ⓘImportant traits for &'_ mut R
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,