pub trait RateLimiter: Send + Sync {
// Required method
fn is_allowed<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
limit: u32,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Per-minute request gate: returns true when key is still within limit
requests for the current minute, false when the caller must be rejected.
Required Methods§
Sourcefn is_allowed<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
limit: u32,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_allowed<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
limit: u32,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns whether key may proceed under limit requests for the current minute.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".