Struct eternity::BucketBuilder[][src]

pub struct BucketBuilder { /* fields omitted */ }

Builds a Bucket.

The term hit represents one attempt to hit the rate limit.

Implementations

impl BucketBuilder[src]

#[must_use]pub fn new() -> Self[src]

A bucket collecting tickets per command invocation.

pub fn delay(&mut self, secs: u64) -> &mut Self[src]

The time to elapse between hitting the limiter.

Expressed in seconds.

pub fn time_span(&mut self, secs: u64) -> &mut Self[src]

How long the bucket will apply for.

Expressed in seconds.

pub fn limit(&mut self, n: u32) -> &mut Self[src]

Number of hits allowed per time_span.

pub fn await_ratelimits(&mut self, is_awaiting: bool) -> &mut Self[src]

If this is set to true, the invocation of the command will be delayed amount times instead of stopping command dispatch.

By default this value is false and rate limits will cancel instead.

pub fn build<Key, Value>(&mut self) -> Bucket<Key, Value> where
    Key: Hash + PartialEq + Clone + Eq + Send + Sync,
    Value: Clone + Send
[src]

Constructs the bucket.

Trait Implementations

impl Default for BucketBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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.