pub struct LimitState<K, P = TokenBucketPolicy, B = MemoryBackend> { /* private fields */ }Expand description
Manages per-key state for a specific RateLimitPolicy and RateLimitBackend.
Implementations§
Source§impl<K, P, B> LimitState<K, P, B>
impl<K, P, B> LimitState<K, P, B>
Sourcepub async fn check(
&self,
key: K,
quota: Quota,
) -> Result<RateLimitSnapshot, B::Error>where
K: StorageKey,
pub async fn check(
&self,
key: K,
quota: Quota,
) -> Result<RateLimitSnapshot, B::Error>where
K: StorageKey,
Checks and updates the rate limit for the given key.
Trait Implementations§
Source§impl<K: Clone, P: Clone, B: Clone> Clone for LimitState<K, P, B>
impl<K: Clone, P: Clone, B: Clone> Clone for LimitState<K, P, B>
Source§fn clone(&self) -> LimitState<K, P, B>
fn clone(&self) -> LimitState<K, P, B>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<K, P> Default for LimitState<K, P, MemoryBackend>where
K: Key,
P: RateLimitPolicy,
impl<K, P> Default for LimitState<K, P, MemoryBackend>where
K: Key,
P: RateLimitPolicy,
Auto Trait Implementations§
impl<K, P, B> Freeze for LimitState<K, P, B>where
B: Freeze,
impl<K, P, B> RefUnwindSafe for LimitState<K, P, B>
impl<K, P, B> Send for LimitState<K, P, B>
impl<K, P, B> Sync for LimitState<K, P, B>
impl<K, P, B> Unpin for LimitState<K, P, B>
impl<K, P, B> UnsafeUnpin for LimitState<K, P, B>where
B: UnsafeUnpin,
impl<K, P, B> UnwindSafe for LimitState<K, P, B>
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