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
An active rate limit that restricts data ingestion.
A rate limit defines restrictions for specific data categories within a particular scope. It includes an expiration time after which the limit is no longer enforced.
Rate limits can be created from Quotas or directly constructed with the needed parameters.
Fields§
§categories: DataCategoriesA set of data categories that this quota applies to. If empty, this rate limit applies to all data categories.
scope: RateLimitScopeThe scope of this rate limit.
reason_code: Option<ReasonCode>A machine-readable reason indicating which quota caused this rate limit.
retry_after: RetryAfterA marker when this rate limit expires.
namespaces: SmallVec<[MetricNamespace; 1]>The metric namespace of this rate limit.
Only relevant for data categories of type metric bucket. 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 from the given Quota.
This builds a rate limit with the appropriate scope derived from the quota and scoping information. The categories and other properties are copied from the quota.
Sourcepub fn matches(&self, scoping: ItemScoping) -> bool
 
pub fn matches(&self, scoping: ItemScoping) -> bool
Checks whether this rate limit applies to the given item.
A rate limit applies if its scope matches the item’s scope, and the item’s category and namespace match those of the rate limit.
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§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>
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>
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