pub struct ItemScoping {
pub category: DataCategory,
pub scoping: Scoping,
pub namespace: MetricNamespaceScoping,
}Expand description
Data categorization and scoping information for a single item.
ItemScoping combines a data category, scoping information, and optional
metric namespace to fully define an item for rate limiting purposes.
Fields§
§category: DataCategoryThe data category of the item.
scoping: ScopingScoping of the data.
namespace: MetricNamespaceScopingNamespace 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 for the given quota scope.
Maps the quota scope type to the corresponding identifier from this scoping,
or None if the scope type doesn’t have an applicable identifier.
Methods from Deref<Target = Scoping>§
Sourcepub fn item(&self, category: DataCategory) -> ItemScoping
pub fn item(&self, category: DataCategory) -> ItemScoping
Creates an ItemScoping for a specific data category in this scope.
The returned item scoping contains a reference to this scope and the provided data category. This is a cheap operation that allows for efficient rate limiting of individual items.
Sourcepub fn metric_bucket(&self, namespace: MetricNamespace) -> ItemScoping
pub fn metric_bucket(&self, namespace: MetricNamespace) -> ItemScoping
Creates an ItemScoping specifically for metric buckets in this scope.
The returned item scoping contains a reference to this scope, the
DataCategory::MetricBucket category, and the provided metric namespace.
This is specialized for handling metrics with namespaces.
Trait Implementations§
Source§impl Clone for ItemScoping
impl Clone for ItemScoping
Source§fn clone(&self) -> ItemScoping
fn clone(&self) -> ItemScoping
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ItemScoping
impl Debug for ItemScoping
Source§impl Deref for ItemScoping
impl Deref for ItemScoping
Source§impl PartialEq for ItemScoping
impl PartialEq for ItemScoping
impl Copy for ItemScoping
impl Eq for ItemScoping
impl StructuralPartialEq for ItemScoping
Auto Trait Implementations§
impl Freeze for ItemScoping
impl RefUnwindSafe for ItemScoping
impl Send for ItemScoping
impl Sync for ItemScoping
impl Unpin for ItemScoping
impl UnwindSafe for ItemScoping
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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