pub struct MerkleTree<TableType, StorageType> { /* private fields */ }
Implementations§
source§impl<TableType, StorageType> MerkleTree<TableType, StorageType>
impl<TableType, StorageType> MerkleTree<TableType, StorageType>
pub const fn empty_root() -> &'static Bytes32
pub fn root(&self) -> Bytes32
pub fn into_storage(self) -> StorageType
pub fn storage(&self) -> &StorageType
source§impl<TableType, StorageType, StorageError> MerkleTree<TableType, StorageType>where
TableType: Mappable<Key = Bytes32, Value = Primitive, OwnedValue = Primitive>,
StorageType: StorageInspect<TableType, Error = StorageError>,
impl<TableType, StorageType, StorageError> MerkleTree<TableType, StorageType>where
TableType: Mappable<Key = Bytes32, Value = Primitive, OwnedValue = Primitive>,
StorageType: StorageInspect<TableType, Error = StorageError>,
source§impl<TableType, StorageType, StorageError> MerkleTree<TableType, StorageType>where
TableType: Mappable<Key = Bytes32, Value = Primitive, OwnedValue = Primitive>,
StorageType: StorageMutate<TableType, Error = StorageError>,
impl<TableType, StorageType, StorageError> MerkleTree<TableType, StorageType>where
TableType: Mappable<Key = Bytes32, Value = Primitive, OwnedValue = Primitive>,
StorageType: StorageMutate<TableType, Error = StorageError>,
sourcepub fn from_set<B, I, D>(
storage: StorageType,
set: I,
) -> Result<Self, StorageError>
pub fn from_set<B, I, D>( storage: StorageType, set: I, ) -> Result<Self, StorageError>
Build a sparse Merkle tree from a set of key-value pairs. This is
equivalent to creating an empty sparse Merkle tree and sequentially
calling update for each key-value pair. This constructor
is more performant than calling individual sequential updates and is the
preferred approach when the key-values are known upfront. Leaves can be
appended to the returned tree using update
to further accumulate leaf
data.
pub fn update( &mut self, key: MerkleTreeKey, data: &[u8], ) -> Result<(), MerkleTreeError<StorageError>>
pub fn delete( &mut self, key: MerkleTreeKey, ) -> Result<(), MerkleTreeError<StorageError>>
source§impl<TableType, StorageType, StorageError> MerkleTree<TableType, StorageType>where
TableType: Mappable<Key = Bytes32, Value = Primitive, OwnedValue = Primitive>,
StorageType: StorageInspect<TableType, Error = StorageError>,
impl<TableType, StorageType, StorageError> MerkleTree<TableType, StorageType>where
TableType: Mappable<Key = Bytes32, Value = Primitive, OwnedValue = Primitive>,
StorageType: StorageInspect<TableType, Error = StorageError>,
pub fn generate_proof( &self, key: &MerkleTreeKey, ) -> Result<Proof, MerkleTreeError<StorageError>>
Trait Implementations§
Auto Trait Implementations§
impl<TableType, StorageType> Freeze for MerkleTree<TableType, StorageType>where
StorageType: Freeze,
impl<TableType, StorageType> RefUnwindSafe for MerkleTree<TableType, StorageType>where
StorageType: RefUnwindSafe,
TableType: RefUnwindSafe,
impl<TableType, StorageType> Send for MerkleTree<TableType, StorageType>
impl<TableType, StorageType> Sync for MerkleTree<TableType, StorageType>
impl<TableType, StorageType> Unpin for MerkleTree<TableType, StorageType>
impl<TableType, StorageType> UnwindSafe for MerkleTree<TableType, StorageType>where
StorageType: UnwindSafe,
TableType: 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