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 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 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 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 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 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 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 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 fn pop(this: PeekMut<'a, T, A>) -> T
Removes the peeked value from the heap and returns it.
associated_function
alloc
Stable since 1.18.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct BTreeMap<K, V, A>
An ordered map based on a B-Tree.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn append(&mut self, other: &mut Self)
Moves all elements from other into self, leaving other empty.
method
alloc
Stable since 1.11.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn clear(&mut self)
Clears the map, removing all elements.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn contains_key<Q>(&self, key: &Q) -> bool
Returns true if the map contains a value for the specified key.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn entry(&mut self, key: K) -> Entry<'_, K, V, A>
Gets the given key's corresponding entry in the map for in-place manipulation.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn extract_if<F, R>(&mut self, range: R, pred: F) -> ExtractIf<'_, K, V, R, F, A>
Creates an iterator that visits elements (key-value pairs) in the specified range in ascending key order and uses a closure to determine if an element should be removed.
method
alloc
Stable since 1.91.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn first_entry(&mut self) -> Option<OccupiedEntry<'_, K, V, A>>
Returns the first entry in the map for in-place manipulation. The key of this entry is the minimum key in the map.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn first_key_value(&self) -> Option<(&K, &V)>
Returns the first key-value pair in the map. The key in this pair is the minimum key in the map.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Returns a reference to the value corresponding to the key.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
Returns the key-value pair corresponding to the supplied key. This is potentially useful:
method
alloc
Stable since 1.40.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
Returns a mutable reference to the value corresponding to the key.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly