Struct ratelimit_meter::Builder
source · pub struct Builder<T>where
T: NewImpl + Sized,{ /* private fields */ }
Expand description
An object that allows incrementally constructing Decider objects.
Implementations
sourceimpl<T> Builder<T>where
T: NewImpl + Sized,
impl<T> Builder<T>where
T: NewImpl + Sized,
sourcepub fn cell_weight(
&mut self,
weight: NonZeroU32
) -> Result<&mut Builder<T>, InconsistentCapacity>
pub fn cell_weight(
&mut self,
weight: NonZeroU32
) -> Result<&mut Builder<T>, InconsistentCapacity>
Sets the “weight” of each cell being checked against the bucket. Each cell fills the bucket by this much.
sourcepub fn per(&mut self, time_unit: Duration) -> &mut Builder<T>
pub fn per(&mut self, time_unit: Duration) -> &mut Builder<T>
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.
sourcepub fn build(&self) -> Result<T, InconsistentCapacity>
pub fn build(&self) -> Result<T, InconsistentCapacity>
Builds a decider of the specified type.
Auto Trait Implementations
impl<T> RefUnwindSafe for Builder<T>where
T: RefUnwindSafe,
impl<T> Send for Builder<T>where
T: Send,
impl<T> Sync for Builder<T>where
T: Sync,
impl<T> Unpin for Builder<T>where
T: Unpin,
impl<T> UnwindSafe for Builder<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more