prio-queue 0.1.1

A simple priority queue implemented as a heap stored in a Vec
Documentation
  • Coverage
  • 84%
    21 out of 25 items documented1 out of 24 items with examples
  • Size
  • Source code size: 21.29 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 7.27 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • uben0/prio-queue
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • uben0

Priority Queue

A simple priority queue implemented in Rust as a binary heap stored in a Vec<T>.

This implementation aims to be simple and more flexible than the one provided by the standard library. It relies on a given function to determine priority between elements. Let you acces the underlying Vec<T> with consistency check or not.

Example

let mut queue = PrioQueue::new(|l, r| l < r);
queue.push(42);
queue.push(32);
queue.push(64);
assert_eq!(queue.pop(), Some(32));
assert_eq!(queue.pop(), Some(42));
assert_eq!(queue.pop(), Some(64));
assert_eq!(queue.pop(), None);

Display

              ╭───────────────9───────────────╮             
      ╭───────26──────╮               ╭───────27──────╮     
  ╭───45──╮       ╭───34──╮       ╭───35──╮       ╭───37──╮ 
╭─59╮   ╭─52╮   ╭─48      57      67      39      80      73
77  61  64  74  96