20 releases (breaking)

0.16.0 Oct 19, 2022
0.15.0-rkyv.0 May 18, 2022
0.14.0-rc.0 Feb 23, 2022
0.11.0-rc.0 Nov 4, 2021
0.4.0 Jun 10, 2020

#815 in Cryptography

Download history 6/week @ 2025-01-01 17/week @ 2025-01-15 14/week @ 2025-02-12 44/week @ 2025-02-19 4/week @ 2025-02-26 91/week @ 2025-03-05 233/week @ 2025-03-12 270/week @ 2025-03-19 702/week @ 2025-03-26 379/week @ 2025-04-02 71/week @ 2025-04-09

1,450 downloads per month

MPL-2.0 license

20KB
451 lines

NStack

A stack data structure with indexed lookup.


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));

Dependencies

~43KB