RateLimitAlgorithm

Trait RateLimitAlgorithm 

Source
pub trait RateLimitAlgorithm {
    // Required methods
    fn requests_per_second(&self) -> u64;
    fn update<'life0, 'async_trait>(
        &'life0 self,
        sample: RequestSample,
    ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An algorithm for controlling request rate limits.

Required Methods§

Source

fn requests_per_second(&self) -> u64

The current requests per second limit.

Source

fn update<'life0, 'async_trait>( &'life0 self, sample: RequestSample, ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the rate limit in response to a request completion.

Implementors§