pub struct LeanIMT { /* private fields */ }
Implementations§
Source§impl LeanIMT
impl LeanIMT
pub fn new(hash: IMTHashFunction) -> Self
Sourcepub fn insert(&mut self, leaf: IMTNode) -> Result<IMTNode, &'static str>
pub fn insert(&mut self, leaf: IMTNode) -> Result<IMTNode, &'static str>
Inserts a new leaf into the tree.
Sourcepub fn insert_many(
&mut self,
leaves: Vec<IMTNode>,
) -> Result<IMTNode, &'static str>
pub fn insert_many( &mut self, leaves: Vec<IMTNode>, ) -> Result<IMTNode, &'static str>
Inserts multiple leaves into the tree.
Sourcepub fn update(
&mut self,
old_leaf: &IMTNode,
new_leaf: IMTNode,
sibling_nodes: &[IMTNode],
) -> Result<IMTNode, &'static str>
pub fn update( &mut self, old_leaf: &IMTNode, new_leaf: IMTNode, sibling_nodes: &[IMTNode], ) -> Result<IMTNode, &'static str>
Updates an existing leaf in the tree.
Sourcepub fn remove(
&mut self,
old_leaf: &IMTNode,
sibling_nodes: &[IMTNode],
) -> Result<IMTNode, &'static str>
pub fn remove( &mut self, old_leaf: &IMTNode, sibling_nodes: &[IMTNode], ) -> Result<IMTNode, &'static str>
Removes a leaf from the tree.
Sourcepub fn index_of(&self, leaf: &IMTNode) -> Result<usize, &'static str>
pub fn index_of(&self, leaf: &IMTNode) -> Result<usize, &'static str>
Returns the index of a leaf in the tree.
pub fn get_depth(&self) -> usize
pub fn get_side_nodes(&self) -> HashMap<usize, IMTNode>
pub fn get_leaves(&self) -> HashMap<IMTNode, usize>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LeanIMT
impl RefUnwindSafe for LeanIMT
impl Send for LeanIMT
impl Sync for LeanIMT
impl Unpin for LeanIMT
impl UnwindSafe for LeanIMT
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