pub struct InMemoryBackend { /* private fields */ }Expand description
In-memory backend backed by a DashMap.
Suitable for single-node deployments. Each key tracks its last-allowed timestamp and a token-bucket counter.
Implementations§
Trait Implementations§
Source§impl Clone for InMemoryBackend
impl Clone for InMemoryBackend
Source§fn clone(&self) -> InMemoryBackend
fn clone(&self) -> InMemoryBackend
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 Default for InMemoryBackend
Available on crate feature in-memory only.
impl Default for InMemoryBackend
Available on crate feature
in-memory only.Source§impl RateLimitBackend for InMemoryBackend
impl RateLimitBackend for InMemoryBackend
Source§fn check<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
quota: &'life2 Quota,
) -> Pin<Box<dyn Future<Output = RateLimitResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn check<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
quota: &'life2 Quota,
) -> Pin<Box<dyn Future<Output = RateLimitResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if a request for
key is allowed under the given quota.Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryBackend
impl Freeze for InMemoryBackend
impl Send for InMemoryBackend
impl Sync for InMemoryBackend
impl Unpin for InMemoryBackend
impl UnsafeUnpin for InMemoryBackend
impl UnwindSafe for InMemoryBackend
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