pub trait Heap {
    type Item;
    type Key;

    fn new() -> Self;
    fn clear(&mut self);
    fn is_empty(&self) -> bool;
    fn insert(&mut self, key: Self::Key) -> Self::Item;
    fn decrease(&mut self, item: Self::Item);
    fn pop_min(&mut self) -> Option<Self::Key>;
    fn key(&mut self, _: Self::Item) -> &mut Self::Key;
}
Expand description

Interface for heap data-structures.

Required Associated Types

Type of items on the heap.

Type of keys.

Required Methods

Return a newly allocated heap.

Remove all elements from the heap.

Return true if heap is empty.

Insert a new item into the heap.

Decrease the key of an item.

Return the minimal key.

Returns the current key of an item.

Implementors