merkle_core/lib.rs
1//! # merkle-core
2//!
3//! Shared traits, types, and error handling for the **`MerkleForge`** workspace.
4//!
5//! This crate is the foundation that every other crate in the workspace
6//! depends on. It contains no concrete tree logic — that lives in
7//! `merkle-variants`. Keeping the core abstract allows `merkle-bench` and
8//! future crates to import only this lightweight foundation.
9//!
10//! ## Contents
11//! | Module | Description |
12//! |--------|-------------|
13//! | [`error`] | Unified [`error::MerkleError`] enum |
14//! | [`traits`] | [`traits::HashFunction`], [`traits::MerkleTree`], [`traits::ProofVerifier`], [`traits::Serializable`] |
15//! | [`types`] | [`types::LeafIndex`], [`types::NodeIndex`], [`types::MerkleProof`], [`types::TreeMetadata`], etc. |
16//!
17//! ## Quick start
18//!
19//! ```rust,ignore
20//! use merkle_core::prelude::*;
21//!
22//! // Any type implementing HashFunction can drive a tree:
23//! // use merkle_hash::Sha256;
24//! // let mut tree = BinaryMerkleTree::<Sha256>::new();
25//! ```
26
27#![deny(missing_docs)]
28#![forbid(unsafe_code)]
29
30pub mod error;
31pub mod traits;
32pub mod types;
33
34/// Re-exports of the most commonly used items.
35pub mod prelude {
36 pub use crate::error::MerkleError;
37 pub use crate::traits::{HashFunction, MerkleTree, ProofVerifier, Serializable};
38 pub use crate::types::{LeafIndex, MerkleProof, NodeIndex, ProofNode, ProofSide, TreeMetadata};
39}