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 moresource§impl<'a> Debug for ItemScoping<'a>
impl<'a> Debug for ItemScoping<'a>
source§impl Deref for ItemScoping<'_>
impl Deref for ItemScoping<'_>
impl<'a> Copy for ItemScoping<'a>
Auto Trait Implementations§
impl<'a> Freeze for ItemScoping<'a>
impl<'a> RefUnwindSafe for ItemScoping<'a>
impl<'a> Send for ItemScoping<'a>
impl<'a> Sync for ItemScoping<'a>
impl<'a> Unpin for ItemScoping<'a>
impl<'a> UnwindSafe for ItemScoping<'a>
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
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>
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