Keyed Priority Queue
A Rust library with priority queue that supports changing of priority item in queue or early removal. To change priority you need to use some key.
Minimal supported Rust version enforced by Cargo.toml.
Usage
An example of code:
use ;
let mut queue = new;
// Currently queue is empty
assert_eq!;
queue.push;
queue.push;
queue.push;
queue.push;
queue.push;
// Peek return references to most important pair.
assert_eq!;
assert_eq!;
// We can clone queue if both key and priority is clonable
let mut queue_clone = queue.clone;
// We can run consuming iterator on queue,
// and it will return items in decreasing order
for in queue_clone
// Popping always will return the biggest element
assert_eq!;
// We can change priority of item by key:
queue.set_priority;
// And get it
assert_eq!;
// Now biggest element is Fourth
assert_eq!;
// We can also decrease priority!
queue.set_priority;
assert_eq!;
assert_eq!;
assert_eq!;
// Now queue is empty
assert_eq!;
// There are Entry API if you want to avoid double hash lookups
match queue.entry;
match queue.entry;
// We can clear queue
queue.clear;
assert!;