pub struct RequestConcurrencyLimit { /* private fields */ }Expand description
Load-shedding middleware: bounds the number of requests in flight and
rejects the excess with an explicit 429 Too Many Requests +
Retry-After, instead of letting them queue silently on the DB pool
until a client timeout or an upstream 502 (see module docs above).
Implementations§
Source§impl RequestConcurrencyLimit
impl RequestConcurrencyLimit
pub fn new(config: ConcurrencyLimitConfig) -> Self
Trait Implementations§
Source§impl Clone for RequestConcurrencyLimit
impl Clone for RequestConcurrencyLimit
Source§fn clone(&self) -> RequestConcurrencyLimit
fn clone(&self) -> RequestConcurrencyLimit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S, B> Transform<S, ServiceRequest> for RequestConcurrencyLimitwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: MessageBody + 'static,
impl<S, B> Transform<S, ServiceRequest> for RequestConcurrencyLimitwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: MessageBody + 'static,
Source§type Transform = RequestConcurrencyLimitMiddleware<S>
type Transform = RequestConcurrencyLimitMiddleware<S>
The
TransformService value created by this factorySource§type Future = Ready<Result<<RequestConcurrencyLimit as Transform<S, ServiceRequest>>::Transform, <RequestConcurrencyLimit as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<RequestConcurrencyLimit as Transform<S, ServiceRequest>>::Transform, <RequestConcurrencyLimit as Transform<S, ServiceRequest>>::InitError>>
The future response value.
Source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations§
impl !RefUnwindSafe for RequestConcurrencyLimit
impl !UnwindSafe for RequestConcurrencyLimit
impl Freeze for RequestConcurrencyLimit
impl Send for RequestConcurrencyLimit
impl Sync for RequestConcurrencyLimit
impl Unpin for RequestConcurrencyLimit
impl UnsafeUnpin for RequestConcurrencyLimit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.