concurrency_traits/semaphore/
async.rs

1use crate::semaphore::TrySemaphore;
2use alloc::boxed::Box;
3use async_trait::async_trait;
4
5/// A generic semaphore that can be waited on asynchronously.
6///
7/// # Safety
8/// This trait is marked as unsafe to allow for safe code to rely on the standard semaphore contract.
9/// [`Default`] implementations should initialize the count at 0.
10#[async_trait]
11pub unsafe trait AsyncSemaphore: TrySemaphore {
12    /// Awaits until able to decrement then decrements.
13    async fn wait_async(&self);
14}