pub trait PersistentUniversalMerkleTreeScheme: UniversalMerkleTreeScheme {
// Required method
fn persistent_update_with<F>(
&self,
pos: impl Borrow<Self::Index>,
f: F,
) -> Result<Self, MerkleTreeError>
where F: FnOnce(Option<&Self::Element>) -> Option<Self::Element>;
// Provided methods
fn persistent_update(
&self,
pos: impl Borrow<Self::Index>,
elem: impl Borrow<Self::Element>,
) -> Result<Self, MerkleTreeError> { ... }
fn persistent_remove(
&self,
pos: Self::Index,
) -> Result<Self, MerkleTreeError> { ... }
}
Expand description
A universal merkle tree that allows non destructive updates. A non destructive update doesn’t directly modify the existing content, it creates a new copy about the update so that people could access both the old version and the new.
Required Methods§
Sourcefn persistent_update_with<F>(
&self,
pos: impl Borrow<Self::Index>,
f: F,
) -> Result<Self, MerkleTreeError>
fn persistent_update_with<F>( &self, pos: impl Borrow<Self::Index>, f: F, ) -> Result<Self, MerkleTreeError>
A persistent update_with interface, check PersistentUniversalMerkleTreeScheme and UniversalMerkleTreeScheme::update_with.
Provided Methods§
Sourcefn persistent_update(
&self,
pos: impl Borrow<Self::Index>,
elem: impl Borrow<Self::Element>,
) -> Result<Self, MerkleTreeError>
fn persistent_update( &self, pos: impl Borrow<Self::Index>, elem: impl Borrow<Self::Element>, ) -> Result<Self, MerkleTreeError>
A non destructive update interface, check PersistentUniversalMerkleTreeScheme and UniversalMerkleTreeScheme::update.
Sourcefn persistent_remove(&self, pos: Self::Index) -> Result<Self, MerkleTreeError>
fn persistent_remove(&self, pos: Self::Index) -> Result<Self, MerkleTreeError>
A persistent remove interface, check PersistentUniversalMerkleTreeScheme and UniversalMerkleTreeScheme::remove.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.