Struct sparse_merkle_tree::tree::SparseMerkleTree [−][src]
Sparse merkle tree
Implementations
impl<H: Hasher + Default, V: Value, S: Store<V>> SparseMerkleTree<H, V, S>
[src]
pub fn new(root: H256, store: S) -> SparseMerkleTree<H, V, S>
[src]
Build a merkle tree from root and store
pub fn root(&self) -> &H256
[src]
Merkle root
pub fn is_empty(&self) -> bool
[src]
Check empty of the tree
pub fn take_store(self) -> S
[src]
Destroy current tree and retake store
pub fn store(&self) -> &S
[src]
Get backend store
pub fn store_mut(&mut self) -> &mut S
[src]
Get mutable backend store
pub fn update(&mut self, key: H256, value: V) -> Result<&H256>
[src]
Update a leaf, return new merkle root set to zero value to delete a key
pub fn get(&self, key: &H256) -> Result<V>
[src]
Get value of a leaf return zero value if leaf not exists
pub fn merkle_proof(&self, keys: Vec<H256>) -> Result<MerkleProof>
[src]
Generate merkle proof
Trait Implementations
impl<H: Debug, V: Debug, S: Debug> Debug for SparseMerkleTree<H, V, S>
[src]
impl<H: Default, V: Default, S: Default> Default for SparseMerkleTree<H, V, S>
[src]
fn default() -> SparseMerkleTree<H, V, S>
[src]
Auto Trait Implementations
impl<H, V, S> RefUnwindSafe for SparseMerkleTree<H, V, S> where
H: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
H: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<H, V, S> Send for SparseMerkleTree<H, V, S> where
H: Send,
S: Send,
V: Send,
H: Send,
S: Send,
V: Send,
impl<H, V, S> Sync for SparseMerkleTree<H, V, S> where
H: Sync,
S: Sync,
V: Sync,
H: Sync,
S: Sync,
V: Sync,
impl<H, V, S> Unpin for SparseMerkleTree<H, V, S> where
H: Unpin,
S: Unpin,
V: Unpin,
H: Unpin,
S: Unpin,
V: Unpin,
impl<H, V, S> UnwindSafe for SparseMerkleTree<H, V, S> where
H: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
H: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,