Struct sparse_merkle_tree::tree::SparseMerkleTree[][src]

pub struct SparseMerkleTree<H, V, S> { /* fields omitted */ }

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]

Auto Trait Implementations

impl<H, V, S> RefUnwindSafe for SparseMerkleTree<H, V, S> where
    H: RefUnwindSafe,
    S: RefUnwindSafe,
    V: RefUnwindSafe

impl<H, V, S> Send for SparseMerkleTree<H, V, S> where
    H: Send,
    S: Send,
    V: Send

impl<H, V, S> Sync for SparseMerkleTree<H, V, S> where
    H: Sync,
    S: Sync,
    V: Sync

impl<H, V, S> Unpin for SparseMerkleTree<H, V, S> where
    H: Unpin,
    S: Unpin,
    V: Unpin

impl<H, V, S> UnwindSafe for SparseMerkleTree<H, V, S> where
    H: UnwindSafe,
    S: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.