PriorityQueue - Rust #002 - Fairness
This video is in French.
In this second episode, we enhance our Priority Queue to add fairness between producers.
We introduce entities, a mechanism inspired by fair scheduling, so that no single source can monopolize the queue.
What you will learn
- Manage fairness between producers (fair scheduling)
- Structure data with HashMap, VecDeque and HashSet
- Understand the role of generic constraints (Eq, Hash, Clone)
- Discover NLL (Non-Lexical Lifetimes) in the Rust compiler
Technologies: Rust, Cargo, HashMap, VecDeque, HashSet. Level: intermediate to advanced.
This step prepares the rest of the series: we will move to concurrency, with a multithreaded then asynchronous version under Tokio.
Source code: github.com/xigh/pq-async-rs
PriorityQueue in Rust
- PriorityQueue - Rust #001 · 10-Oct-2025
- PriorityQueue - Rust #002 - Fairness · 17-Oct-2025
- PriorityQueue - Rust #003 - Multithreading · 26-Oct-2025
- PriorityQueue - Rust #004 - Blocking Dequeue · 02-Nov-2025
- PriorityQueue - Rust #005 - Graceful Shutdown · 09-Nov-2025
- PriorityQueue - Rust #006 - async/await · 16-Nov-2025