[−][src]Struct governor::Quota
A rate-limiting quota.
Quotas are expressed in a positive number of "cells" (the number of positive decisions / allowed items) per unit of time.
Neither the number of cells nor the unit of time may be zero.
Burst sizes
There are multiple ways of expressing the same quota: a quota given as Quota::per_second(1)
allows, on average, the same number of cells through as a quota given as Quota::per_minute(60)
.
However, the quota of Quota::per_minute(60)
has a burst size of 60 cells, meaning it is possible
to accommodate 60 cells in one go, followed by a minute of waiting.
Methods
impl Quota
[src]
pub const fn per_second(max_burst: NonZeroU32) -> Quota
[src]
Construct a quota for a number of cells per second.
pub const fn per_minute(max_burst: NonZeroU32) -> Quota
[src]
Construct a quota for a number of cells per 60-second period.
pub const fn per_hour(max_burst: NonZeroU32) -> Quota
[src]
Construct a quota for a number of cells per 60-minute (3600-second) period.
pub fn new(max_burst: NonZeroU32, per: Duration) -> Option<Quota>
[src]
Construct a quota for a given burst size per unit of time.
Returns None
if the duration is zero.
Trait Implementations
impl Clone for Quota
[src]
impl Copy for Quota
[src]
impl Eq for Quota
[src]
impl PartialEq<Quota> for Quota
[src]
impl Debug for Quota
[src]
impl StructuralPartialEq for Quota
[src]
impl StructuralEq for Quota
[src]
Auto Trait Implementations
impl Send for Quota
impl Sync for Quota
impl Unpin for Quota
impl UnwindSafe for Quota
impl RefUnwindSafe for Quota
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,