pub struct BinSearchTree<T> { /* private fields */ }Implementations§
Source§impl<T> BinSearchTree<T>where
T: Ord,
impl<T> BinSearchTree<T>where
T: Ord,
Sourcepub fn new_with_capacity(size: usize) -> Self
pub fn new_with_capacity(size: usize) -> Self
Creates a new, empty binary search tree with a given (growable) initial capacity.
Sourcepub fn insert(&mut self, key: T)
pub fn insert(&mut self, key: T)
Inserts the given key into the tree. New insertions in a simple BST are always leafs. This implementation does not guarantee uniqueness.
pub fn remove(&mut self, key: T) -> Option<T>
Sourcepub fn iter(&self) -> InOrderIter<'_, T>
pub fn iter(&self) -> InOrderIter<'_, T>
Produces a “snapshot” iterator over immutable references to the tree in its current state.
Trait Implementations§
Source§impl<T: Debug> Debug for BinSearchTree<T>
impl<T: Debug> Debug for BinSearchTree<T>
Auto Trait Implementations§
impl<T> Freeze for BinSearchTree<T>
impl<T> RefUnwindSafe for BinSearchTree<T>where
T: RefUnwindSafe,
impl<T> Send for BinSearchTree<T>where
T: Send,
impl<T> Sync for BinSearchTree<T>where
T: Sync,
impl<T> Unpin for BinSearchTree<T>where
T: Unpin,
impl<T> UnwindSafe for BinSearchTree<T>where
T: 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