Struct relay_quotas::ItemScoping
source · pub struct ItemScoping<'a> {
pub category: DataCategory,
pub scoping: &'a Scoping,
pub namespace: MetricNamespaceScoping,
}
Expand description
Data categorization and scoping information.
ItemScoping
is always attached to a Scope
and references it internally. It is a cheap,
copyable type intended for the use with RateLimits
and RateLimiter
. It implements
Deref<Target = Scoping>
and AsRef<Scoping>
for ease of use.
Fields§
§category: DataCategory
The data category of the item.
scoping: &'a Scoping
Scoping of the data.
namespace: MetricNamespaceScoping
Namespace for metric items, requiring DataCategory::MetricBucket
.
Implementations§
source§impl ItemScoping<'_>
impl ItemScoping<'_>
sourcepub fn scope_id(&self, scope: QuotaScope) -> Option<u64>
pub fn scope_id(&self, scope: QuotaScope) -> Option<u64>
Returns the identifier of the given scope.
Methods from Deref<Target = Scoping>§
sourcepub fn item(&self, category: DataCategory) -> ItemScoping<'_>
pub fn item(&self, category: DataCategory) -> ItemScoping<'_>
Returns an ItemScoping
for this scope.
The item scoping will contain a reference to this scope and the information passed to this function. This is a cheap operation to allow rate limiting for an individual item.
sourcepub fn metric_bucket(&self, namespace: MetricNamespace) -> ItemScoping<'_>
pub fn metric_bucket(&self, namespace: MetricNamespace) -> ItemScoping<'_>
Returns an ItemScoping
for metric buckets in this scope.
The item scoping will contain a reference to this scope, the category `MetricBucket, and the information passed to this function. This is a cheap operation to allow rate limiting for an individual item.
Trait Implementations§
source§impl AsRef<Scoping> for ItemScoping<'_>
impl AsRef<Scoping> for ItemScoping<'_>
source§impl<'a> Clone for ItemScoping<'a>
impl<'a> Clone for ItemScoping<'a>
source§fn clone(&self) -> ItemScoping<'a>
fn clone(&self) -> ItemScoping<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more