Struct containers::collections::Heap[][src]

pub struct Heap<T, Rel: TotalOrderRelation<T> = Core, A: Alloc = NullAllocator> { /* fields omitted */ }

Growable heap in terms of Vec

Methods

impl<T, Rel: TotalOrderRelation<T>, A: Alloc> Heap<T, Rel, A>
[src]

Make a new heap.

Make a new heap with enough room to hold at least cap elements.

Failures

Returns None if allocation fails.

Return arity.

Return number of elements in heap.

Return number of elements heap can hold before reallocation.

Make sure the heap has enough room for at least n_more more elements, reallocating if need be.

Failures

Returns false if allocation fails, true otherwise.

Build a heap of the elements of v.

Push an element into the heap.

Pop the root element off the heap and return it; return None if heap empty.

Return a reference to root element, or None if heap empty.

Return a mutable reference to root element, or None if heap empty.

Pops the root and inserts the given value. xs being empty is an error.

Return a Vec of elements of heap in unspecified order.

Return a Vec of elements of heap in sorted order.

Trait Implementations

impl<T: Debug, Rel: Debug + TotalOrderRelation<T>, A: Debug + Alloc> Debug for Heap<T, Rel, A>
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<T, Rel, A> Send for Heap<T, Rel, A> where
    A: Send,
    Rel: Send,
    T: Send

impl<T, Rel, A> Sync for Heap<T, Rel, A> where
    A: Sync,
    Rel: Sync,
    T: Sync