Trait MerkleLeaves

Source
pub trait MerkleLeaves {
    type Leaf: CommitId<CommitmentId = MerkleHash>;

    // Required method
    fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &Self::Leaf>;
}
Expand description

Trait, which can be implemented for any collection type such that its elements can be easily merklized with MerkleHash::merklize.

Required Associated Types§

Source

type Leaf: CommitId<CommitmentId = MerkleHash>

The type of the collection element.

It must be able to produce a commitment in the form of a MerkleHash.

Required Methods§

Source

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &Self::Leaf>

Get an iterator over all collection elements that have to be merklized.

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.

Implementations on Foreign Types§

Source§

impl<T, const LEN: usize> MerkleLeaves for [T; LEN]
where T: CommitId<CommitmentId = MerkleHash>,

Source§

type Leaf = T

Source§

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &T>

Source§

impl<T, const MIN: usize> MerkleLeaves for Confined<BTreeSet<T>, MIN, { _ }>
where T: CommitId<CommitmentId = MerkleHash> + Ord,

Source§

type Leaf = T

Source§

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &T>

Source§

impl<T, const MIN: usize> MerkleLeaves for Confined<BTreeSet<T>, MIN, { _ }>
where T: CommitId<CommitmentId = MerkleHash> + Ord,

Source§

type Leaf = T

Source§

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &T>

Source§

impl<T, const MIN: usize> MerkleLeaves for Confined<BTreeSet<T>, MIN, { _ }>
where T: CommitId<CommitmentId = MerkleHash> + Ord,

Source§

type Leaf = T

Source§

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &T>

Source§

impl<T, const MIN: usize> MerkleLeaves for Confined<Vec<T>, MIN, { _ }>
where T: CommitId<CommitmentId = MerkleHash>,

Source§

type Leaf = T

Source§

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &T>

Source§

impl<T, const MIN: usize> MerkleLeaves for Confined<Vec<T>, MIN, { _ }>
where T: CommitId<CommitmentId = MerkleHash>,

Source§

type Leaf = T

Source§

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &T>

Source§

impl<T, const MIN: usize> MerkleLeaves for Confined<Vec<T>, MIN, { _ }>
where T: CommitId<CommitmentId = MerkleHash>,

Source§

type Leaf = T

Source§

fn merkle_leaves(&self) -> impl ExactSizeIterator<Item = &T>

Implementors§