Struct eternity::BucketBuilder [−][src]
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]
Key: Hash + PartialEq + Clone + Eq + Send + Sync,
Value: Clone + Send,
Constructs the bucket.
Trait Implementations
impl Default for BucketBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for BucketBuilder
impl Send for BucketBuilder
impl Sync for BucketBuilder
impl Unpin for BucketBuilder
impl UnwindSafe for BucketBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,