pub struct CachedRateLimits(/* private fields */);
Expand description
Like RateLimits
, a collection of scoped rate limits but with all the checks
necessary to cache the limits.
The data structure makes sure no expired rate limits are enforced.
Implementations§
source§impl CachedRateLimits
impl CachedRateLimits
sourcepub fn add(&self, limit: RateLimit)
pub fn add(&self, limit: RateLimit)
Adds a limit to this collection.
See also: RateLimits::add
.
sourcepub fn merge(&self, limits: RateLimits)
pub fn merge(&self, limits: RateLimits)
Merges more rate limits into this instance.
See also: RateLimits::merge
.
sourcepub fn current_limits(&self) -> Arc<RateLimits>
pub fn current_limits(&self) -> Arc<RateLimits>
Returns a reference to the contained rate limits.
This call guarantees that at the time of call no returned rate limit is expired.
Trait Implementations§
source§impl Debug for CachedRateLimits
impl Debug for CachedRateLimits
source§impl Default for CachedRateLimits
impl Default for CachedRateLimits
source§fn default() -> CachedRateLimits
fn default() -> CachedRateLimits
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for CachedRateLimits
impl RefUnwindSafe for CachedRateLimits
impl Send for CachedRateLimits
impl Sync for CachedRateLimits
impl Unpin for CachedRateLimits
impl UnwindSafe for CachedRateLimits
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more