pub trait CacheAwareRateLimiter:
Send
+ Sync
+ 'static {
// Required methods
fn until_key_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn check_key(&self, key: &str) -> bool;
}
Available on crate feature
rate-limiting
only.Expand description
A trait for rate limiting that can be implemented by different rate limiting strategies
Required Methods§
Sourcefn until_key_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn until_key_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Wait until a request to the given key (typically a domain or URL) is allowed This method should block until the rate limit allows the request to proceed