pub struct BTreeMap<'store, K, V> { /* private fields */ }Expand description
A copyable, immutable b-tree map, which doesn’t drop its contents.
Implementations§
Source§impl<'store, K, V> BTreeMap<'store, K, V>
impl<'store, K, V> BTreeMap<'store, K, V>
Sourcepub fn contains_key<Q: Ord>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
pub fn contains_key<Q: Ord>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
Whether the map contains the key
Sourcepub fn get<Q: Ord>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
pub fn get<Q: Ord>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
Returns a reference to the value corresponding to the key.
Sourcepub fn get_key<Q: Ord>(&self, key: &Q) -> Option<&K>where
K: Borrow<Q>,
pub fn get_key<Q: Ord>(&self, key: &Q) -> Option<&K>where
K: Borrow<Q>,
Returns a reference to the equivalent key
This is (only) useful when Q is a different type than K.
Sourcepub fn get_key_value<Q: Ord>(&self, key: &Q) -> Option<(&K, &V)>where
K: Borrow<Q>,
pub fn get_key_value<Q: Ord>(&self, key: &Q) -> Option<(&K, &V)>where
K: Borrow<Q>,
Returns a reference to the equivalent key and associated value
This is (only) useful when Q is a different type than K.
Sourcepub fn first_key_value(&self) -> Option<(&K, &V)>
pub fn first_key_value(&self) -> Option<(&K, &V)>
Returns the first key and value
Sourcepub fn last_key_value(&self) -> Option<(&K, &V)>
pub fn last_key_value(&self) -> Option<(&K, &V)>
Returns the last key and value
Sourcepub fn validate(&self)
pub fn validate(&self)
Validates the map, panicing if it is invalid. Specifically, we check that the number of entries in each node is within the b-tree invariant bounds, and that the keys are in order.
Ideally, this should always be a no-op.
Sourcepub fn range<Q: Ord>(&self, bounds: impl RangeBounds<Q>) -> Range<'_, K, V>where
K: Borrow<Q>,
pub fn range<Q: Ord>(&self, bounds: impl RangeBounds<Q>) -> Range<'_, K, V>where
K: Borrow<Q>,
Iterates over the map’s key-value pairs in order, within the given range.
Sourcepub fn range_keys<Q: Ord>(
&self,
bounds: impl RangeBounds<Q>,
) -> impl Iterator<Item = &K> + '_where
K: Borrow<Q>,
pub fn range_keys<Q: Ord>(
&self,
bounds: impl RangeBounds<Q>,
) -> impl Iterator<Item = &K> + '_where
K: Borrow<Q>,
Iterates over the map’s keys in order, within the given range.
Sourcepub fn range_values<Q: Ord>(
&self,
bounds: impl RangeBounds<Q>,
) -> impl Iterator<Item = &V> + '_where
K: Borrow<Q>,
pub fn range_values<Q: Ord>(
&self,
bounds: impl RangeBounds<Q>,
) -> impl Iterator<Item = &V> + '_where
K: Borrow<Q>,
Iterates over the map’s values in order, within the given range.