pub trait ForgetableUniversalMerkleTreeScheme: ForgetableMerkleTreeScheme + UniversalMerkleTreeScheme {
// Required methods
fn universal_forget(
&mut self,
pos: Self::Index,
) -> LookupResult<Self::Element, Self::MembershipProof, Self::NonMembershipProof>;
fn non_membership_remember(
&mut self,
pos: Self::Index,
proof: impl Borrow<Self::NonMembershipProof>,
) -> Result<(), MerkleTreeError>;
}
Expand description
Universal Merkle tree that allows forget/remember elements from the memory
Required Methods§
Sourcefn universal_forget(
&mut self,
pos: Self::Index,
) -> LookupResult<Self::Element, Self::MembershipProof, Self::NonMembershipProof>
fn universal_forget( &mut self, pos: Self::Index, ) -> LookupResult<Self::Element, Self::MembershipProof, Self::NonMembershipProof>
Trim the leaf at position pos
from memory.
This is similar to forget, but it
may prune even an empty sub-tree at pos
and will return a
non-membership proof for the pruned position if it does so. Note
that an implementation may choose not to prune an empty sub-tree, as
it may be more efficient to represent an empty sub-tree than a
forgotten one. In this case,
universal_lookup may
return either LookupResult::NotInMemory or
LookupResult::NotFound after a successful call to
universal_forget. In any case, if this
function is called for a pos
which is in memory but not in the
tree, it will return a non-membership proof.
The return value is the same as if universal_lookup were called before this call.
Sourcefn non_membership_remember(
&mut self,
pos: Self::Index,
proof: impl Borrow<Self::NonMembershipProof>,
) -> Result<(), MerkleTreeError>
fn non_membership_remember( &mut self, pos: Self::Index, proof: impl Borrow<Self::NonMembershipProof>, ) -> Result<(), MerkleTreeError>
“Re-insert” an empty leaf into the tree using its proof.
Returns Ok(())
if insertion is successful, or Err(err)
if the proof
disagrees with the merkle tree
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.