[][src]Struct governor::Quota

pub struct Quota { /* fields omitted */ }

A rate-limiting quota in cells 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]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,