1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Runtime-agnostic priority semaphore.
//!
//! This crate provides [`PrioritySemaphore`], an asynchronous semaphore where
//! waiters supply a signed priority. Higher priorities are granted returned
//! permits before lower ones, and equal priorities use FIFO order. The
//! implementation uses only the standard `Future`/`Waker` contract and does
//! not depend on a particular async runtime.
//!
//! ```rust
//! use std::sync::Arc;
//! use priority_semaphore::PrioritySemaphore;
//!
//! # #[tokio::main]
//! # async fn main() {
//! let semaphore = Arc::new(PrioritySemaphore::new(4));
//! let permit = semaphore.acquire(10).await.unwrap();
//! // The permit is returned automatically, including during unwinding.
//! drop(permit);
//! # }
//! ```
extern crate alloc;
extern crate std;
pub use crate;
pub use cratePermit;
pub use crate;
pub use crateAcquireFuture;