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