pub trait IsMerkleTreeBackend: Default {
    type Node: PartialEq + Eq + Clone + Sync + Send;
    type Data: Sync + Send;

    // Required methods
    fn hash_data(leaf: &Self::Data) -> Self::Node;
    fn hash_new_parent(child_1: &Self::Node, child_2: &Self::Node) -> Self::Node;

    // Provided method
    fn hash_leaves(unhashed_leaves: &[Self::Data]) -> Vec<Self::Node> { ... }
}
Expand description

A backend for Merkle trees. This defines raw Data from which the Merkle tree is built from. It also defines the Node type and the hash function used to build parent nodes from children nodes.

Required Associated Types§

Required Methods§

source

fn hash_data(leaf: &Self::Data) -> Self::Node

This function takes a single variable Data and converts it to a node.

source

fn hash_new_parent(child_1: &Self::Node, child_2: &Self::Node) -> Self::Node

This function takes to children nodes and builds a new parent node. It will be used in the construction of the Merkle tree.

Provided Methods§

source

fn hash_leaves(unhashed_leaves: &[Self::Data]) -> Vec<Self::Node>

This function takes the list of data from which the Merkle tree will be built from and converts it to a list of leaf nodes.

Object Safety§

This trait is not object safe.

Implementors§