doc.rust-lang.org
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Inserts a key-value pair into the map.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_keys(self) -> IntoKeys<K, V, A>
Creates a consuming iterator visiting all the keys, in sorted order. The map cannot be used after calling this. The iterator element type is K.
method
alloc
Stable since 1.54.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_values(self) -> IntoValues<K, V, A>
Creates a consuming iterator visiting all the values, in order by key. The map cannot be used after calling this. The iterator element type is V.
method
alloc
Stable since 1.54.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_empty(&self) -> bool
Returns true if the map contains no elements.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_, K, V>
Gets an iterator over the entries of the map, sorted by key.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>
Gets a mutable iterator over the entries of the map, sorted by key.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn keys(&self) -> Keys<'_, K, V>
Gets an iterator over the keys of the map, in sorted order.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn last_entry(&mut self) -> Option<OccupiedEntry<'_, K, V, A>>
Returns the last entry in the map for in-place manipulation. The key of this entry is the maximum key in the map.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn last_key_value(&self) -> Option<(&K, &V)>
Returns the last key-value pair in the map. The key in this pair is the maximum key in the map.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn len(&self) -> usize
Returns the number of elements in the map.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> BTreeMap<K, V>
Makes a new, empty BTreeMap.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_first(&mut self) -> Option<(K, V)>
Removes and returns the first element in the map. The key of this element is the minimum key that was in the map.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_last(&mut self) -> Option<(K, V)>
Removes and returns the last element in the map. The key of this element is the maximum key that was in the map.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn range<T, R>(&self, range: R) -> Range<'_, K, V>
Constructs a double-ended iterator over a sub-range of elements in the map. The simplest way is to use the range syntax min..max, thus range(min..max) will yield elements from min (inclusive) to max (exclusive). The range may also be entered as (Bound<T>, Bound<T>), so for example range((Excluded(4), Included(10))) will yield a left-exclusive, right-inclusive range from 4 to 10.
method
alloc
Stable since 1.17.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn range_mut<T, R>(&mut self, range: R) -> RangeMut<'_, K, V>
Constructs a mutable double-ended iterator over a sub-range of elements in the map. The simplest way is to use the range syntax min..max, thus range(min..max) will yield elements from min (inclusive) to max (exclusive). The range may also be entered as (Bound<T>, Bound<T>), so for example range((Excluded(4), Included(10))) will yield a left-exclusive, right-inclusive range from 4 to 10.
method
alloc
Stable since 1.17.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
Removes a key from the map, returning the value at the key if the key was previously in the map.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
Removes a key from the map, returning the stored key and value if the key was previously in the map.
method
alloc
Stable since 1.45.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.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_off<Q>(&mut self, key: &Q) -> Self
Splits the collection into two at the given key. Returns everything after the given key, including the key. If the key is not present, the split will occur at the nearest greater key, or return an empty map if no such key exists.
method
alloc
Stable since 1.11.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn values(&self) -> Values<'_, K, V>
Gets an iterator over the values of the map, in order by key.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly