Struct RateLimit
pub struct RateLimit<T> { /* private fields */ }
Enforces a rate limit on the number of requests the underlying service can handle over a period of time.
Implementations
impl<T> RateLimit<T>
fn new(inner: T, rate: Rate) -> SelfCreate a new rate limiter
fn get_ref(&self) -> &TGet a reference to the inner service
fn get_mut(&mut self) -> &mut TGet a mutable reference to the inner service
fn into_inner(self) -> TConsume
self, returning the inner service
Trait Implementations
impl<S> Load for RateLimit<S>
where
S: Load,
type Metric = <S as Load>::Metric;fn load(&self) -> Self::Metric
impl<S, Request> Service<Request> for RateLimit<S>
where
S: Service<Request>,
type Response = <S as Service<Request>>::Response;type Error = <S as Service<Request>>::Error;type Future = <S as Service<Request>>::Future;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn call(&mut self, request: Request) -> Self::Future
impl<T: Debug> Debug for RateLimit<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result