Struct GlobalConcurrencyLimitLayer

pub struct GlobalConcurrencyLimitLayer { /* private fields */ }

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>

Trait Implementations

impl Clone for GlobalConcurrencyLimitLayer

fn clone(&self) -> Self

impl Debug for GlobalConcurrencyLimitLayer

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

impl<S> Layer<S> for GlobalConcurrencyLimitLayer

type Service = ConcurrencyLimit<S>;
fn layer(&self, service: S) -> Self::Service

Auto Trait Implementations

impl !RefUnwindSafe for GlobalConcurrencyLimitLayer

impl !UnwindSafe for GlobalConcurrencyLimitLayer

impl Freeze for GlobalConcurrencyLimitLayer

impl Send for GlobalConcurrencyLimitLayer

impl Sync for GlobalConcurrencyLimitLayer

impl Unpin for GlobalConcurrencyLimitLayer

impl UnsafeUnpin for GlobalConcurrencyLimitLayer

Blanket Implementations

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

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

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

impl<T> CloneToUninit for GlobalConcurrencyLimitLayer where T: Clone,

impl<T> From<T> for GlobalConcurrencyLimitLayer

impl<T> Instrument for GlobalConcurrencyLimitLayer

impl<T> ToOwned for GlobalConcurrencyLimitLayer where T: Clone,

impl<T> WithSubscriber for GlobalConcurrencyLimitLayer

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

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

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