pub struct TreeMap<K, V>(/* private fields */)
where
K: Clone + Ord,
V: Clone;
Expand description
A cheaply-cloneable ordered map based on a SumTree.
Implementations§
Source§impl<K: Clone + Ord, V: Clone> TreeMap<K, V>
impl<K: Clone + Ord, V: Clone> TreeMap<K, V>
pub fn from_ordered_entries(entries: impl IntoIterator<Item = (K, V)>) -> Self
pub fn is_empty(&self) -> bool
pub fn get(&self, key: &K) -> Option<&V>
pub fn insert(&mut self, key: K, value: V)
pub fn extend(&mut self, iter: impl IntoIterator<Item = (K, V)>)
pub fn clear(&mut self)
pub fn remove(&mut self, key: &K) -> Option<V>
pub fn remove_range( &mut self, start: &impl MapSeekTarget<K>, end: &impl MapSeekTarget<K>, )
Sourcepub fn closest(&self, key: &K) -> Option<(&K, &V)>
pub fn closest(&self, key: &K) -> Option<(&K, &V)>
Returns the key-value pair with the greatest key less than or equal to the given key.
pub fn iter_from<'a>( &'a self, from: &K, ) -> impl Iterator<Item = (&'a K, &'a V)> + 'a
pub fn update<F, T>(&mut self, key: &K, f: F) -> Option<T>
pub fn retain<F: FnMut(&K, &V) -> bool>(&mut self, predicate: F)
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)> + '_
pub fn values(&self) -> impl Iterator<Item = &V> + '_
pub fn first(&self) -> Option<(&K, &V)>
pub fn last(&self) -> Option<(&K, &V)>
pub fn insert_tree(&mut self, other: TreeMap<K, V>)
Trait Implementations§
impl<K, V> Eq for TreeMap<K, V>
impl<K, V> StructuralPartialEq for TreeMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for TreeMap<K, V>
impl<K, V> RefUnwindSafe for TreeMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for TreeMap<K, V>
impl<K, V> Sync for TreeMap<K, V>
impl<K, V> Unpin for TreeMap<K, V>
impl<K, V> UnwindSafe for TreeMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more