Struct min_max_heap::MinMaxHeap [] [src]

pub struct MinMaxHeap<T>(_);

A double-ended priority queue.

Methods

impl<T> MinMaxHeap<T>
[src]

Creates a new, empty MinMaxHeap.

Creates a new, empty MinMaxHeap with space allocated to hold len elements.

The number of elements in the heap.

Is the heap empty?

impl<T: Ord> MinMaxHeap<T>
[src]

Adds an element to the heap.

Gets a reference to the minimum element, if any.

Gets a reference to the maximum element, if any.

Removes the minimum element, if any.

Removes the maximum element, if any.

Pushes an element, then pops the minimum element.

Unlike a push followed by a pop, this combined operation will not allocate.

Pushes an element, then pops the maximum element in an optimized fashion.

Unlike a push followed by a pop, this combined operation will not allocate.

Pops the minimum, then pushes an element in an optimized fashion.

Pops the maximum, then pushes an element in an optimized fashion.

Returns an ascending (sorted) vector, reusing the heap’s storage.

Returns an descending (sorted) vector, reusing the heap’s storage.

impl<T> MinMaxHeap<T>
[src]

Drops all items from the heap.

The number of elements the heap can hold without reallocating.

Reserves the minimum capacity for exactly additional more elements to be inserted in the given MinMaxHeap.

Panics

Panics if the new capacity overflows usize.

Reserves the minimum capacity for at least additional more elements to be inserted in the given MinMaxHeap.

Panics

Panics if the new capacity overflows usize.

Discards extra capacity.

Consumes the MinMaxHeap and returns its elements in a vector in arbitrary order.

Returns a borrowing iterator over the min-max-heap’s elements in arbitrary order.

Returns a draining iterator over the min-max-heap’s elements in arbitrary order.

Trait Implementations

impl<T: Clone> Clone for MinMaxHeap<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for MinMaxHeap<T>
[src]

Formats the value using the given formatter.

impl<T> Default for MinMaxHeap<T>
[src]

Returns the "default value" for a type. Read more

impl<'a, T> IntoIterator for &'a MinMaxHeap<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a, T> IntoIterator for MinMaxHeap<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<T: Ord> FromIterator<T> for MinMaxHeap<T>
[src]

Creates a value from an iterator. Read more

impl<T: Ord> From<Vec<T>> for MinMaxHeap<T>
[src]

Performs the conversion.

impl<T: Ord> Extend<T> for MinMaxHeap<T>
[src]

Extends a collection with the contents of an iterator. Read more

impl<'a, T: Ord + Clone + 'a> Extend<&'a T> for MinMaxHeap<T>
[src]

Extends a collection with the contents of an iterator. Read more