pub struct RateLimit {
pub categories: DataCategories,
pub scope: RateLimitScope,
pub reason_code: Option<ReasonCode>,
pub retry_after: RetryAfter,
pub namespaces: SmallVec<[MetricNamespace; 1]>,
}
Expand description
A bounded rate limit.
Fields§
§categories: DataCategories
A set of data categories that this quota applies to. If missing or empty, this rate limit applies to all data.
scope: RateLimitScope
The scope of this rate limit.
reason_code: Option<ReasonCode>
A machine readable reason indicating which quota caused it.
retry_after: RetryAfter
A marker when this rate limit expires.
namespaces: SmallVec<[MetricNamespace; 1]>
The metric namespace of this rate limit.
Ignored on all data categories except for MetricBucket
. If empty, this rate limit applies
to metrics of all namespaces.
Implementations§
source§impl RateLimit
impl RateLimit
sourcepub fn from_quota(
quota: &Quota,
scoping: &Scoping,
retry_after: RetryAfter,
) -> Self
pub fn from_quota( quota: &Quota, scoping: &Scoping, retry_after: RetryAfter, ) -> Self
Creates a new rate limit for the given Quota
.
sourcepub fn matches(&self, scoping: ItemScoping<'_>) -> bool
pub fn matches(&self, scoping: ItemScoping<'_>) -> bool
Checks whether the rate limit applies to the given item.
Trait Implementations§
impl StructuralPartialEq for RateLimit
Auto Trait Implementations§
impl Freeze for RateLimit
impl RefUnwindSafe for RateLimit
impl Send for RateLimit
impl Sync for RateLimit
impl Unpin for RateLimit
impl UnwindSafe for RateLimit
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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