Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

dusk-network/nstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Dusk CI codecov

nstack

nstack is a stack-like merkle datastructure for storing and accessing indexed values.

Operations supported are add and remove at the end of the structure, and mutable access to indexed leaves.

Usage example

use nstack::annotation::Cardinality;
use nstack::NStack;

let mut nt = NStack::<i32, Cardinality>::new();

nt.push(0);
nt.push(1);

// mutable references to the last element
if let Some(mut branch) = nt.nth_mut(1) {
    *branch = 2;
}

assert_eq!(nt.pop(), Some(2));
assert_eq!(nt.pop(), Some(0));