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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! # ranked-semaphore
//!
//! **A priority-aware semaphore for async Rust.**
//!
//! ## Features
//! - Priority scheduling: Configurable priority-based task ordering
//! - No runtime dependency: Works with any async runtime (Tokio, async-std, smol, etc.)
//! - Flexible queue strategies: FIFO/LIFO and custom strategy
//! - High performance: Optimized for low latency and high throughput
//!
//! ## Quick Start
//! ```rust
//! use ranked_semaphore::RankedSemaphore;
//!
//! #[tokio::main]
//! async fn main() {
//! // Create a semaphore with 3 permits, FIFO strategy
//! let sem = RankedSemaphore::new_fifo(3);
//!
//! // Acquire a permit (default priority)
//! let permit = sem.acquire().await.unwrap();
//!
//! // Acquire with custom priority
//! let high = sem.acquire_with_priority(10).await.unwrap();
//!
//! // Release permits automatically on drop
//! drop(permit);
//! drop(high);
//! }
//! ```
//!
//! ## Advanced Usage
//!
//! Use [`PriorityConfig`] and [`QueueStrategy`] for fine-grained control:
//!
//! ```rust
//! use ranked_semaphore::{RankedSemaphore, PriorityConfig, QueueStrategy};
//! use std::sync::Arc;
//!
//! #[tokio::main]
//! async fn main() {
//! let config = PriorityConfig::new()
//! .default_strategy(QueueStrategy::Fifo)
//! .exact(10, QueueStrategy::Lifo);
//!
//! let limiter = Arc::new(RankedSemaphore::new_with_config(2, config));
//!
//! let _admin = limiter.acquire_with_priority(10).await.unwrap();
//! let _guest = limiter.acquire_with_priority(0).await.unwrap();
//! }
//! ```
//!
//! See the [README](https://github.com/yeungkc/ranked-semaphore#readme) and [API docs](https://docs.rs/ranked-semaphore) for more details.
pub use ;
pub use ;
pub use ;