Struct splay::map::SplayMap
[−]
[src]
pub struct SplayMap<K: Ord, V> { /* fields omitted */ }
The implementation of this splay tree is largely based on the c code at: ftp://ftp.cs.cmu.edu/usr/ftp/usr/sleator/splaying/top-down-splay.c This version of splaying is a top-down splay operation.
Methods
impl<K: Ord, V> SplayMap<K, V>
[src]
fn new() -> SplayMap<K, V>
fn into_iter(self) -> IntoIter<K, V>
Moves all values out of this map, transferring ownership to the given iterator.
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn clear(&mut self)
Clears the tree in O(1) extra space (including the stack). This is necessary to prevent stack exhaustion with extremely large trees.
fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Ord,
K: Borrow<Q>,
Q: Ord,
Return true if the map contains a value for the specified key
fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Ord,
K: Borrow<Q>,
Q: Ord,
Return a reference to the value corresponding to the key
fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Ord,
K: Borrow<Q>,
Q: Ord,
Return a mutable reference to the value corresponding to the key
fn insert(&mut self, key: K, value: V) -> Option<V>
Insert a key-value pair from the map. If the key already had a value present in the map, that value is returned. Otherwise None is returned.
fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where
K: Borrow<Q>,
Q: Ord,
K: Borrow<Q>,
Q: Ord,
Removes a key from the map, returning the value at the key if the key was previously in the map.
Trait Implementations
impl<'a, K: Ord, V, Q: ?Sized> Index<&'a Q> for SplayMap<K, V> where
K: Borrow<Q>,
Q: Ord,
[src]
K: Borrow<Q>,
Q: Ord,
type Output = V
The returned type after indexing
fn index(&self, index: &'a Q) -> &V
The method for the indexing (container[index]
) operation
impl<'a, K: Ord, V, Q: ?Sized> IndexMut<&'a Q> for SplayMap<K, V> where
K: Borrow<Q>,
Q: Ord,
[src]
K: Borrow<Q>,
Q: Ord,
fn index_mut(&mut self, index: &'a Q) -> &mut V
The method for the mutable indexing (container[index]
) operation
impl<K: Ord, V> Default for SplayMap<K, V>
[src]
impl<K: Ord, V> FromIterator<(K, V)> for SplayMap<K, V>
[src]
fn from_iter<I: IntoIterator<Item = (K, V)>>(iterator: I) -> SplayMap<K, V>
Creates a value from an iterator. Read more
impl<K: Ord, V> Extend<(K, V)> for SplayMap<K, V>
[src]
fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, i: I)
Extends a collection with the contents of an iterator. Read more
impl<K: Clone + Ord, V: Clone> Clone for SplayMap<K, V>
[src]
fn clone(&self) -> SplayMap<K, V>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more