Struct GlobalConcurrencyLimitLayer

struct GlobalConcurrencyLimitLayer { ... }

Enforces a limit on the concurrent number of requests the underlying service can handle.

Unlike ConcurrencyLimitLayer, which enforces a per-service concurrency limit, this layer accepts a owned semaphore (Arc<Semaphore>) which can be shared across multiple services.

Cloning this layer will not create a new semaphore.

Implementations

impl GlobalConcurrencyLimitLayer

fn new(max: usize) -> Self

Create a new GlobalConcurrencyLimitLayer.

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

Create a new GlobalConcurrencyLimitLayer from a Arc<Semaphore>

impl Clone for GlobalConcurrencyLimitLayer

fn clone(self: &Self) -> GlobalConcurrencyLimitLayer

impl Debug for GlobalConcurrencyLimitLayer

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

impl Freeze for GlobalConcurrencyLimitLayer

impl RefUnwindSafe for GlobalConcurrencyLimitLayer

impl Send for GlobalConcurrencyLimitLayer

impl Sync for GlobalConcurrencyLimitLayer

impl Unpin for GlobalConcurrencyLimitLayer

impl UnsafeUnpin for GlobalConcurrencyLimitLayer

impl UnwindSafe for GlobalConcurrencyLimitLayer

impl<S> Layer for GlobalConcurrencyLimitLayer

fn layer(self: &Self, service: S) -> <Self as >::Service

impl<T> Any for GlobalConcurrencyLimitLayer

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for GlobalConcurrencyLimitLayer

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

impl<T> BorrowMut for GlobalConcurrencyLimitLayer

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

impl<T> CloneToUninit for GlobalConcurrencyLimitLayer

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

impl<T> From for GlobalConcurrencyLimitLayer

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for GlobalConcurrencyLimitLayer

impl<T> ToOwned for GlobalConcurrencyLimitLayer

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

impl<T> WithSubscriber for GlobalConcurrencyLimitLayer

impl<T, U> Into for GlobalConcurrencyLimitLayer

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 GlobalConcurrencyLimitLayer

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

impl<T, U> TryInto for GlobalConcurrencyLimitLayer

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