1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! # MALT
//!
//! Merkle Append-Only Log Tree conforming to
//! [RFC 9162 §2.1](https://www.rfc-editor.org/rfc/rfc9162#section-2.1).
//!
//! This crate provides a generic, append-only Merkle tree parameterized by a
//! [`TreeHasher`] trait. It supports incremental construction, root extraction,
//! inclusion proofs, and consistency proofs.
//!
//! The tree has **zero external dependencies** — callers provide their own hash
//! implementation via [`TreeHasher`].
//!
//! # Usage
//!
//! ```ignore
//! use malt::{Log, TreeHasher};
//!
//! // Implement TreeHasher for your hash function, then:
//! let mut log = Log::new(my_hasher);
//! log.append(b"first entry");
//! log.append(b"second entry");
//! let root = log.root();
//! ```
//!
//! # Panic Policy
//!
//! This crate uses `expect()` in two locations where the stack state is
//! guaranteed by structural invariants:
//!
//! - [`Log::append`] — merge pops are bounded by `count_trailing_ones(size)`,
//! which guarantees sufficient stack depth by construction (A-STACK).
//! - [`Log::root`] — fold over a non-empty stack (guarded by `size > 0`).
//!
//! These are **not** input-validation panics. They guard invariants proven
//! correct by the formal model (§3.4 A-STACK, A-EQUIV). Converting them to
//! `Result` would impose API ergonomic cost for genuinely impossible errors.
pub use Error;
pub use ;
pub use ;