mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-28 23:06:45 +01:00
feat: add leaves() iterator to SimpleSmt
This commit is contained in:
@@ -182,6 +182,14 @@ impl SimpleSmt {
|
||||
self.get_path(index)
|
||||
}
|
||||
|
||||
// ITERATORS
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/// Returns an iterator over the leaves of this [SimpleSmt].
|
||||
pub fn leaves(&self) -> impl Iterator<Item = (u64, &Word)> {
|
||||
self.leaves.iter().map(|(i, w)| (*i, w))
|
||||
}
|
||||
|
||||
/// Returns an iterator over the inner nodes of this Merkle tree.
|
||||
pub fn inner_nodes(&self) -> impl Iterator<Item = InnerNodeInfo> + '_ {
|
||||
self.branches.values().map(|e| InnerNodeInfo {
|
||||
|
||||
Reference in New Issue
Block a user