rokdocs
v0.1

rok::core::collections::heap

rok::core::collections::heap - BinaryHeap<T>, a priority queue over a List laid out as an implicit binary tree. new() pops the greatest item first; by(before) takes the order: before(a, b) puts a nearer the top.

Structs

BinaryHeap

pub struct BinaryHeap<T>
  • pub const fn new() -> BinaryHeap<T>

    A max-heap.

  • pub const fn by(before: fn(T, T) -> bool) -> BinaryHeap<T>

    A heap whose top is the item before ranks first.

  • pub const fn len(self) -> usize
  • pub fn is_empty(self) -> bool
  • pub const fn peek(self) -> T | none

    The top item.

  • pub const fn push(self, x: T)
  • pub const fn pop(self) -> T | none

    Remove and return the top item.

  • pub fn clear(self)
  • pub const fn retain(self, keep: fn(T) -> bool)

    Keep only the items keep accepts; O(n).

  • pub const fn iter(self) -> ListIter<T>

    Every item, in no particular order.

Trait implementations 1
  • impl<T> !Sync for BinaryHeap<T>