pub struct Monotree<D = DefaultDatabase, H = DefaultHasher> { /* private fields */ }
Expand description
A structure for monotree
.
Implementations§
source§impl<D, H> Monotree<D, H>where
D: Database,
H: Hasher,
impl<D, H> Monotree<D, H>where D: Database, H: Hasher,
pub fn new(dbpath: &str) -> Self
sourcepub fn insert(
&mut self,
root: Option<&Hash>,
key: &Hash,
leaf: &Hash
) -> Result<Option<Hash>>
pub fn insert( &mut self, root: Option<&Hash>, key: &Hash, leaf: &Hash ) -> Result<Option<Hash>>
Insert key-leaf entry into the monotree
. Returns a new root hash.
sourcepub fn get(&mut self, root: Option<&Hash>, key: &Hash) -> Result<Option<Hash>>
pub fn get(&mut self, root: Option<&Hash>, key: &Hash) -> Result<Option<Hash>>
Get a leaf hash for the given root and key.
sourcepub fn remove(
&mut self,
root: Option<&Hash>,
key: &[u8]
) -> Result<Option<Hash>>
pub fn remove( &mut self, root: Option<&Hash>, key: &[u8] ) -> Result<Option<Hash>>
Remove the given key and its corresponding leaf from the tree. Returns a new root hash.
sourcepub fn inserts(
&mut self,
root: Option<&Hash>,
keys: &[Hash],
leaves: &[Hash]
) -> Result<Option<Hash>>
pub fn inserts( &mut self, root: Option<&Hash>, keys: &[Hash], leaves: &[Hash] ) -> Result<Option<Hash>>
This method is intended to use the insert()
method in batch mode.
sourcepub fn gets(
&mut self,
root: Option<&Hash>,
keys: &[Hash]
) -> Result<Vec<Option<Hash>>>
pub fn gets( &mut self, root: Option<&Hash>, keys: &[Hash] ) -> Result<Vec<Option<Hash>>>
This method is intended to use the get()
method in batch mode.
Trait Implementations§
source§impl Default for Monotree<DefaultDatabase, DefaultHasher>
impl Default for Monotree<DefaultDatabase, DefaultHasher>
Auto Trait Implementations§
impl<D, H> RefUnwindSafe for Monotree<D, H>where D: RefUnwindSafe, H: RefUnwindSafe,
impl<D, H> Send for Monotree<D, H>where D: Send, H: Send,
impl<D, H> Sync for Monotree<D, H>where D: Sync, H: Sync,
impl<D, H> Unpin for Monotree<D, H>where D: Unpin, H: Unpin,
impl<D, H> UnwindSafe for Monotree<D, H>where D: UnwindSafe, H: 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