Skip to main content

RateLimitBackend

Trait RateLimitBackend 

Source
pub trait RateLimitBackend:
    Send
    + Sync
    + 'static {
    // Required method
    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;
}
Expand description

Backend trait for rate limit state storage.

Required Methods§

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,

Check if a request for key is allowed under the given quota.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§