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) -> SelfCreate a new
GlobalConcurrencyLimitLayer.fn with_semaphore(semaphore: Arc<Semaphore>) -> SelfCreate a new
GlobalConcurrencyLimitLayerfrom aArc<Semaphore>
Trait Implementations
impl Clone for GlobalConcurrencyLimitLayer
fn clone(&self) -> GlobalConcurrencyLimitLayer
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,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for GlobalConcurrencyLimitLayer
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for GlobalConcurrencyLimitLayer
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for GlobalConcurrencyLimitLayer
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for GlobalConcurrencyLimitLayer
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for GlobalConcurrencyLimitLayer
impl<T> ToOwned for GlobalConcurrencyLimitLayer
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for GlobalConcurrencyLimitLayer
impl<T, U> Into<U> for GlobalConcurrencyLimitLayer
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for GlobalConcurrencyLimitLayer
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for GlobalConcurrencyLimitLayer
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>