pub struct InMemoryRateLimitStore { /* private fields */ }Expand description
A RateLimitStore in the process, shared by its clones.
Trait Implementations§
Source§impl Clone for InMemoryRateLimitStore
impl Clone for InMemoryRateLimitStore
Source§impl Debug for InMemoryRateLimitStore
impl Debug for InMemoryRateLimitStore
Source§impl Default for InMemoryRateLimitStore
impl Default for InMemoryRateLimitStore
Source§impl RateLimitStore for InMemoryRateLimitStore
impl RateLimitStore for InMemoryRateLimitStore
Source§fn hit<'life0, 'life1, 'async_trait>(
&'life0 self,
window: &'life1 RateWindow,
limit: u32,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn hit<'life0, 'life1, 'async_trait>(
&'life0 self,
window: &'life1 RateWindow,
limit: u32,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Counts one hit in
window unless its count has reached limit: the count after the
hit, or None when the hit is refused. A window that began later than the stored one
for the same key, class and period starts again from zero. Atomic: concurrent hits
never pass the limit together. Read moreSource§fn purge_before<'life0, 'async_trait>(
&'life0 self,
before: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn purge_before<'life0, 'async_trait>(
&'life0 self,
before: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Drops the windows that began before
before, in Unix seconds; returns how many. A
backend whose windows expire by themselves drops none. Read moreAuto Trait Implementations§
impl Forget for InMemoryRateLimitStore
impl Freeze for InMemoryRateLimitStore
impl Move for InMemoryRateLimitStore
impl RefUnwindSafe for InMemoryRateLimitStore
impl Send for InMemoryRateLimitStore
impl Sync for InMemoryRateLimitStore
impl Unpin for InMemoryRateLimitStore
impl UnsafeUnpin for InMemoryRateLimitStore
impl UnwindSafe for InMemoryRateLimitStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
Converts
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> ⓘ
Converts
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