nstack

Crates.ionstack
lib.rsnstack
version0.16.0
sourcesrc
created_at2020-05-26 16:23:41.778878
updated_at2022-10-19 12:44:01.555539
descriptionArity 4 stack for the kelvin merkle toolkit
homepage
repositoryhttps://github.com/dusk-network/nstack
max_upload_size
id246265
size44,866
Dusk Network (dusknetwork)

documentation

README

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));
Commit count: 93

cargo fmt