Skip to main content

ConcurrentLimitSemaphore

Trait ConcurrentLimitSemaphore 

pub trait ConcurrentLimitSemaphore:
    Send
    + Sync
    + Clone
    + Unpin
    + 'static {
    type Permit: Send + Sync + 'static;

    // Required method
    fn acquire(&self) -> impl Future<Output = Self::Permit> + MaybeSend;
}
Available on crate feature layers-concurrent-limit only.
Expand description

ConcurrentLimitSemaphore abstracts a semaphore-like concurrency primitive that yields an owned permit released on drop.

Required Associated Types§

type Permit: Send + Sync + 'static

The owned permit type associated with the semaphore. Dropping it must release the permit back to the semaphore.

Required Methods§

fn acquire(&self) -> impl Future<Output = Self::Permit> + MaybeSend

Acquire an owned permit asynchronously.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl ConcurrentLimitSemaphore for Arc<Semaphore>

§

type Permit = OwnedSemaphorePermit

§

async fn acquire(&self) -> <Arc<Semaphore> as ConcurrentLimitSemaphore>::Permit ⓘ

Implementors§