Struct ConcurrencyLimit

struct ConcurrencyLimit<T> { ... }

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

Create a new concurrency limiter.

fn with_semaphore(inner: T, semaphore: Arc<Semaphore>) -> Self

Create a new concurrency limiter with a provided shared semaphore

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 ConcurrencyLimit<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 ConcurrencyLimit<S>

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

impl<S, Request> Service for ConcurrencyLimit<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 ConcurrencyLimit<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for ConcurrencyLimit<T>

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

impl<T> BorrowMut for ConcurrencyLimit<T>

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

impl<T> CloneToUninit for ConcurrencyLimit<T>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> Freeze for ConcurrencyLimit<T>

impl<T> From for ConcurrencyLimit<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for ConcurrencyLimit<T>

impl<T> RefUnwindSafe for ConcurrencyLimit<T>

impl<T> Send for ConcurrencyLimit<T>

impl<T> Sync for ConcurrencyLimit<T>

impl<T> ToOwned for ConcurrencyLimit<T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> Unpin for ConcurrencyLimit<T>

impl<T> UnwindSafe for ConcurrencyLimit<T>

impl<T> WithSubscriber for ConcurrencyLimit<T>

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

impl<T, U> Into for ConcurrencyLimit<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 ConcurrencyLimit<T>

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

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

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

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

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

impl<T: Clone> Clone for ConcurrencyLimit<T>

fn clone(self: &Self) -> Self