Struct RateLimit

struct RateLimit<T> { ... }

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) -> Self

Create a new rate limiter

fn get_ref(self: &Self) -> &T

Get a reference to the inner service

fn get_mut(self: &mut Self) -> &mut T

Get a mutable reference to the inner service

fn into_inner(self: Self) -> T

Consume self, returning the inner service

impl<M, S, Target, Request> MakeService for RateLimit<T>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future

impl<S> Load for RateLimit<S>

fn load(self: &Self) -> <Self as >::Metric

impl<S, Request> Service for RateLimit<S>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>
fn call(self: &mut Self, request: Request) -> <Self as >::Future

impl<T> Any for RateLimit<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for RateLimit<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for RateLimit<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> Freeze for RateLimit<T>

impl<T> From for RateLimit<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for RateLimit<T>

impl<T> RefUnwindSafe for RateLimit<T>

impl<T> Send for RateLimit<T>

impl<T> Sync for RateLimit<T>

impl<T> Unpin for RateLimit<T>

impl<T> UnsafeUnpin for RateLimit<T>

impl<T> UnwindSafe for RateLimit<T>

impl<T> WithSubscriber for RateLimit<T>

impl<T, Request> ServiceExt for RateLimit<T>

impl<T, U> Into for RateLimit<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for RateLimit<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for RateLimit<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::fmt::Debug> Debug for RateLimit<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result