pub struct AvlNode<K: Ord, V> {
pub key: K,
pub value: V,
pub hash: Hash,
pub merkle_hash: Hash,
pub height: u32,
pub left: Option<Box<AvlNode<K, V>>>,
pub right: Option<Box<AvlNode<K, V>>>,
}Expand description
A node in the AVL Tree.
Fields§
§key: K§value: V§hash: Hash§merkle_hash: Hash§height: u32§left: Option<Box<AvlNode<K, V>>>§right: Option<Box<AvlNode<K, V>>>Implementations§
Source§impl<K: Ord + AsBytes, V> AvlNode<K, V>
impl<K: Ord + AsBytes, V> AvlNode<K, V>
Sourcepub fn right_hash(&self) -> Option<&[u8]>
pub fn right_hash(&self) -> Option<&[u8]>
The right merkle hash, if any
Sourcepub fn update(&mut self)
pub fn update(&mut self)
Update node meta data, such as its height and merkle hash, by looking at its two children.
Sourcepub fn balance_factor(&self) -> i32
pub fn balance_factor(&self) -> i32
Returns the node’s balance factor (left_height - right_height).
Trait Implementations§
impl<K: Eq + Ord, V: Eq> Eq for AvlNode<K, V>
impl<K: Ord, V> StructuralPartialEq for AvlNode<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for AvlNode<K, V>
impl<K, V> RefUnwindSafe for AvlNode<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for AvlNode<K, V>
impl<K, V> Sync for AvlNode<K, V>
impl<K, V> Unpin for AvlNode<K, V>
impl<K, V> UnwindSafe for AvlNode<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