pub struct TreeRb<K, V>{ /* private fields */ }
Expand description
vector indexed red-black tree implementation
Implementations§
Source§impl<K, V> TreeRb<K, V>
impl<K, V> TreeRb<K, V>
pub fn new() -> TreeRb<K, V>
pub fn len(&self) -> usize
pub fn len_freelist(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn insert(&mut self, key: K, val: V) -> Option<V>
Sourcepub fn remove(&mut self, key: &K) -> Option<V>
pub fn remove(&mut self, key: &K) -> Option<V>
returns the value of the removed item, otherwise return None
Sourcepub fn contains_key(&self, key: K) -> bool
pub fn contains_key(&self, key: K) -> bool
check to see if an item with the input key exists
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
calls shrink to fit on all vectors
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
creates a new rbtree with buf.capacity = capacity
Sourcepub fn predecessor(&self, key: K) -> Option<&V>
pub fn predecessor(&self, key: K) -> Option<&V>
returns the biggest value l<=k which is in the tree
Sourcepub fn successor(&self, key: K) -> Option<&V>
pub fn successor(&self, key: K) -> Option<&V>
returns the smallest value l>=k which is in the tree
Sourcepub fn get(&self, key: K) -> Option<V>
pub fn get(&self, key: K) -> Option<V>
get the value of the item with the input key, otherwise return None
pub fn clear(&mut self)
pub fn print(&mut self)
pub fn check_nodes(&self)
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for TreeRb<K, V>
impl<K, V> RefUnwindSafe for TreeRb<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for TreeRb<K, V>
impl<K, V> Sync for TreeRb<K, V>
impl<K, V> Unpin for TreeRb<K, V>
impl<K, V> UnwindSafe for TreeRb<K, V>where
K: UnwindSafe,
V: UnwindSafe,
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