Struct ConcurrencyLimit
pub struct ConcurrencyLimit<T> { /* private fields */ }
Enforces a limit on the concurrent number of requests the underlying service can handle.
Implementations
impl<T> ConcurrencyLimit<T>
fn new(inner: T, max: usize) -> SelfCreate a new concurrency limiter.
fn with_semaphore(inner: T, semaphore: Arc<Semaphore>) -> SelfCreate a new concurrency limiter with a provided shared semaphore
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 ConcurrencyLimit<S>
where
S: Load,
type Metric = <S as Load>::Metric;fn load(&self) -> Self::Metric
impl<S, Request> Service<Request> for ConcurrencyLimit<S>
where
S: Service<Request>,
type Response = <S as Service<Request>>::Response;type Error = <S as Service<Request>>::Error;type Future = ResponseFuture<<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: Clone> Clone for ConcurrencyLimit<T>
fn clone(&self) -> Self
impl<T: Debug> Debug for ConcurrencyLimit<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result