doc.rust-lang.org
pub struct PeekMut<'a, T, A>
Structure wrapping a mutable reference to the greatest item on a BinaryHeap.
struct
alloc
Stable since 1.12.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Iter<'a, T>
An iterator over the elements of a BinaryHeap.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct IntoIter<T, A>
An owning iterator over the elements of a BinaryHeap.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Drain<'a, T, A>
A draining iterator over the elements of a BinaryHeap.
struct
alloc
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_capacity(capacity: usize) -> BinaryHeap<T>
Creates an empty BinaryHeap with at least the specified capacity.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve the minimum capacity for at least additional elements more than the current length. Unlike try_reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling try_reserve_exact, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if the capacity is already sufficient.
method
alloc
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve capacity for at least additional elements more than the current length. The allocator may reserve more space to speculatively avoid frequent allocations. After calling try_reserve, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if capacity is already sufficient. This method preserves the contents even if an error occurs.
method
alloc
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to_fit(&mut self)
Discards as much additional capacity as possible.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to(&mut self, min_capacity: usize)
Discards capacity with a lower bound.
method
alloc
Stable since 1.56.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn retain<F>(&mut self, f: F)
Retains only the elements specified by the predicate.
method
alloc
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional elements more than the current length. Unlike reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling reserve_exact, capacity will be greater than or equal to self.len() + additional. Does nothing if the capacity is already sufficient.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional elements more than the current length. The allocator may reserve more space to speculatively avoid frequent allocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn push(&mut self, item: T)
Pushes an item onto the binary heap.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop(&mut self) -> Option<T>
Removes the greatest item from the binary heap and returns it, or None if it is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T, A>>
Returns a mutable reference to the greatest item in the binary heap, or None if it is empty.
method
alloc
Stable since 1.12.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn peek(&self) -> Option<&T>
Returns the greatest item in the binary heap, or None if it is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> BinaryHeap<T>
Creates an empty BinaryHeap as a max-heap.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn len(&self) -> usize
Returns the length of the binary heap.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator visiting all values in the underlying vector, in arbitrary order.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_empty(&self) -> bool
Checks if the binary heap is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly