mithril_common::crypto_helper

Trait MKMapValue

Source
pub trait MKMapValue<K: MKMapKey>:
    Clone
    + TryInto<MKTreeNode>
    + TryFrom<MKTreeNode> {
    // Required methods
    fn compute_root(&self) -> StdResult<MKTreeNode>;
    fn contains<T: Into<MKTreeNode> + Clone>(&self, leaf: &T) -> bool;
    fn can_compute_proof(&self) -> bool;
    fn compute_proof<T: Into<MKTreeNode> + Clone>(
        &self,
        leaves: &[T],
    ) -> StdResult<Option<MKMapProof<K>>>;
}
Expand description

The trait implemented by the values of a MKMap

Required Methods§

Source

fn compute_root(&self) -> StdResult<MKTreeNode>

Get the root of the merkelized map value

Source

fn contains<T: Into<MKTreeNode> + Clone>(&self, leaf: &T) -> bool

Check if the merkelized map value contains a leaf

Source

fn can_compute_proof(&self) -> bool

Can the merkelized map value compute a proof

Source

fn compute_proof<T: Into<MKTreeNode> + Clone>( &self, leaves: &[T], ) -> StdResult<Option<MKMapProof<K>>>

Compute the proof for a set of values of the merkelized map

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.

Implementors§