pub trait Hashable: Debug {
    // Required methods
    fn empty_leaf() -> Self;
    fn combine(level: Level, a: &Self, b: &Self) -> Self;

    // Provided method
    fn empty_root(level: Level) -> Self
       where Self: Sized { ... }
}
Expand description

A trait describing the operations that make a type suitable for use as a leaf or node value in a merkle tree.

Required Methods§

source

fn empty_leaf() -> Self

source

fn combine(level: Level, a: &Self, b: &Self) -> Self

Combines two provided nodes that both exist at the specified level of the tree, producing a new node at level level + 1.

Provided Methods§

source

fn empty_root(level: Level) -> Self
where Self: Sized,

Produces an empty root at the specified level of the tree by combining empty leaf values.

At each successive level, the value is produced by combining the value at the level below with a copy of itself.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Hashable for String

Available on crate feature test-dependencies only.
source§

fn empty_leaf() -> Self

source§

fn combine(_: Level, a: &Self, b: &Self) -> Self

source§

impl<H: Hashable> Hashable for Option<H>

Available on crate feature test-dependencies only.
source§

fn empty_leaf() -> Self

source§

fn combine(l: Level, a: &Self, b: &Self) -> Self

Implementors§

source§

impl Hashable for TestNode

source§

impl Hashable for SipHashable

Available on crate feature test-dependencies only.