pub struct BinarySearchTree<K: Ord + Debug, V> { /* private fields */ }
Expand description
A professional-grade, zero-dependency Binary Search Tree (BST) data structure.
Note: This is a simple binary search tree and is not self-balancing. Performance may degrade to O(n) in worst-case scenarios with already sorted data.
§Panics
This implementation will panic if it encounters a key already in the tree.
This is not ideal, and a more robust implementation would return a Result
.
Implementations§
Source§impl<K: Ord + Debug, V> BinarySearchTree<K, V>
impl<K: Ord + Debug, V> BinarySearchTree<K, V>
Sourcepub fn insert(&mut self, key: K, value: V) -> Result<(), BinarySearchTreeError>
pub fn insert(&mut self, key: K, value: V) -> Result<(), BinarySearchTreeError>
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for BinarySearchTree<K, V>
impl<K, V> RefUnwindSafe for BinarySearchTree<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for BinarySearchTree<K, V>
impl<K, V> Sync for BinarySearchTree<K, V>
impl<K, V> Unpin for BinarySearchTree<K, V>
impl<K, V> UnwindSafe for BinarySearchTree<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