pub trait RateLimiter: Send + Sync {
// Required methods
fn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn adjust<'life0, 'life1, 'async_trait>(
&'life0 self,
response: &'life1 Response,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn current_delay<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Duration> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for asynchronous, stateful rate limiters.
Required Methods§
Sourcefn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Blocks until a request is allowed to proceed.