microkelvin
Library for creating and searching through annotated merkle trees.
Built on the canonical
serialization and FFI library.
Compound trait
/// A type that can recursively contain itself and leaves.
The Compound trait defines a type as a collection type. This means that it can be searched and have branches constructed pointing to its elements.
Annotation/Combine trait
/// The trait defining an annotation type over a leaf
/// Trait for defining how to combine Annotations
The annotation and combine traits keep an automatically updated annotation of subtrees, for example total leaf amount (Cardinality
in reference implementation), or which leaf compares the greatest (Max
in reference implementation)
Branch walking
This is ane example of walking a recursive structure to yield a branch pointing at the nth leaf of the collection, if any.
It is automatically implemented on all types implementing Compound
whose annotation can be borrowed as Cardinality
. Giving this capability to any such structure.
usage
Please check out the nstack
implementation of a stack/vector type for a more advanced example.