Struct burger::rate_limit::RateLimit

source ·
pub struct RateLimit<S> { /* private fields */ }
Expand description

A wrapper for the ServiceExt::rate_limit combinator.

See the module for more information.

Trait Implementations§

source§

impl<S: Debug> Debug for RateLimit<S>

source§

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

Formats the value using the given formatter. Read more
source§

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

§

type Response = <S as Service<Request>>::Response

The type produced by the service call.
§

type Permit<'a> = RateLimitPermit<'a, S, Request> where Self: 'a

The type of the permit required to call the service.
source§

async fn acquire(&self) -> Self::Permit<'_>

Obtains a permit.
source§

async fn call<'a>(permit: Self::Permit<'a>, request: Request) -> Self::Response
where Self: 'a,

Consumes a permit to call the service.

Auto Trait Implementations§

§

impl<S> !Freeze for RateLimit<S>

§

impl<S> !RefUnwindSafe for RateLimit<S>

§

impl<S> Send for RateLimit<S>
where S: Send,

§

impl<S> Sync for RateLimit<S>
where S: Sync,

§

impl<S> Unpin for RateLimit<S>
where S: Unpin,

§

impl<S> UnwindSafe for RateLimit<S>
where S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<Request, S> ServiceExt<Request> for S
where S: Service<Request>,

source§

async fn oneshot(&self, request: Request) -> Self::Response
where Self: Sized,

Acquires the Service::Permit and then immediately uses it to call the Service. Read more
source§

fn then<F>(self, closure: F) -> Then<Self, F>
where Self: Sized,

Extends the service using a closure accepting Self::Response and returning a Future. Read more
source§

fn map<F>(self, closure: F) -> Map<Self, F>
where Self: Sized,

Extends the service using a closure accepting Self::Response and returning a Future. Read more
source§

fn concurrency_limit(self, n_permits: usize) -> ConcurrencyLimit<Self>
where Self: Sized,

Applies a concurrency limit to the service with a specified number of permits. Read more
source§

fn load_shed(self) -> LoadShed<Self>
where Self: Sized,

Applies load shedding to the service. Read more
source§

fn buffer(self, capacity: usize) -> Buffer<Self>
where Self: Sized,

Applies buffering to the service with a specified capacity. Read more
source§

fn rate_limit(self, interval: Duration, permits: usize) -> RateLimit<Self>
where Self: Sized,

Applies rate limiting to the service with a specified interval and number of permits. Read more
source§

fn retry<P>(self, policy: P) -> Retry<Self, P>
where Self: Sized,

Applies retries to tbe service with a specified Policy. Read more
source§

fn depressurize(self) -> Depressurize<Self>
where Self: Sized,

Depressurizes the service. Read more
source§

fn pending_requests(self) -> PendingRequests<Self>
where Self: Sized,

Records Load on the service, measured by number of pending requests. Read more
source§

fn leak<'t>(self: Arc<Self>) -> Leak<'t, Self>
where Self: Sized,

Extends the lifetime of the permit. Read more
source§

fn left<T>(self) -> Either<Self, T>
where Self: Sized,

Wraps as Either::Left. For the other variant see ServiceExt::right. Read more
source§

fn right<T>(self) -> Either<T, Self>
where Self: Sized,

Wraps as Either::Right. For the other variant see ServiceExt::right. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<Request, Ok, Error, S> TryService<Request> for S
where S: Service<Request, Response = Result<Ok, Error>>,

§

type Ok = Ok

The Result::Ok variant of the Service::Response.
§

type Error = Error

The Result::Err variant of the Service::Response.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more