pub struct MemoryBackend { /* private fields */ }Expand description
In-memory storage backend suitable for single-node deployments.
Implementations§
Source§impl MemoryBackend
impl MemoryBackend
Source§impl MemoryBackend
impl MemoryBackend
Sourcepub fn storage_key<P>(namespace: &str, subject: &str, quota: Quota) -> Stringwhere
P: RateLimitPolicy,
pub fn storage_key<P>(namespace: &str, subject: &str, quota: Quota) -> Stringwhere
P: RateLimitPolicy,
Builds a storage key for the given subject and quota.
Trait Implementations§
Source§impl Clone for MemoryBackend
impl Clone for MemoryBackend
Source§fn clone(&self) -> MemoryBackend
fn clone(&self) -> MemoryBackend
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 MemoryBackend
impl Default for MemoryBackend
Source§impl RateLimitBackend for MemoryBackend
impl RateLimitBackend for MemoryBackend
Source§type Error = CodecError
type Error = CodecError
Error type returned by this backend.
Source§fn transact<'life0, 'life1, 'async_trait, P>(
&'life0 self,
storage_key: &'life1 str,
quota: Quota,
now_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<RateLimitSnapshot, Self::Error>> + Send + 'async_trait>>where
P: RateLimitPolicy + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transact<'life0, 'life1, 'async_trait, P>(
&'life0 self,
storage_key: &'life1 str,
quota: Quota,
now_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<RateLimitSnapshot, Self::Error>> + Send + 'async_trait>>where
P: RateLimitPolicy + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically loads policy state, applies the rate limit algorithm, and persists the result.
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryBackend
impl !UnwindSafe for MemoryBackend
impl Freeze for MemoryBackend
impl Send for MemoryBackend
impl Sync for MemoryBackend
impl Unpin for MemoryBackend
impl UnsafeUnpin for MemoryBackend
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