pub trait RateLimiter: Send + Sync {
// Required method
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
cost: u32,
) -> Pin<Box<dyn Future<Output = Result<RateDecision, ExtensionsError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Swappable rate-limit backend.
Required Methods§
Sourcefn check<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
cost: u32,
) -> Pin<Box<dyn Future<Output = Result<RateDecision, ExtensionsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
cost: u32,
) -> Pin<Box<dyn Future<Output = Result<RateDecision, ExtensionsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically decide-and-reserve cost units for key.