Module tree

Source
Expand description

The data model and construction facilities for Merkle trees.

The data of constructed, immutable Merkle trees are represented by types MerkleTree, Node, LeafNode, and HashNode. All of these types are comparable for equality with other of these types where it makes sense, except that LeafNode and HashNode are not directly comparable and never compare against the other type as equal when found gisguised by MerkleTree or Node. Each of the types also implements Eq and std::hash::Hash. Practical uniqueness of the hash values in a Merkle tree is used to provide fast implementations for the standard equality comparison and hashing traits. However, if the hashing algorithm has been chosen poorly, incorrect results may occur. Also note that leaf data never figure in hashing or equality comparisons.

Modules§

parallel
Building Merkle trees in parallel.

Structs§

Builder
The facility for constructing Merkle trees.
Children
An iterator over borrowed values of tree nodes, usually being the child nodes of a single hash node.
EmptyTree
The error value returned when a tree was attempted to be constructed from empty input.
HashNode
A value representing an internal node in Merkle tree.
LeafNode
A value representing a leaf node in a Merkle tree.
MerkleTree
A Merkle tree.

Enums§

Node
A Merkle tree node, which can be either a leaf node or a hash node.

Type Aliases§

BuildResult
A convenience type alias for the result type used by this crate.