#tree #arena #index #trie #indextree

indextree

Arena based tree structure by using indices instead of reference counted pointers

12 stable releases (3 major)

✓ Uses Rust 2018 edition

new 3.2.0 Apr 18, 2019
3.1.1 Mar 31, 2019
3.1.0 Jan 19, 2019
3.0.0 Sep 30, 2018
0.1.1 Dec 22, 2016

#30 in Data structures

Download history 143/week @ 2019-01-03 49/week @ 2019-01-10 53/week @ 2019-01-17 51/week @ 2019-01-24 47/week @ 2019-01-31 68/week @ 2019-02-07 53/week @ 2019-02-14 40/week @ 2019-02-21 94/week @ 2019-02-28 60/week @ 2019-03-07 32/week @ 2019-03-14 145/week @ 2019-03-21 123/week @ 2019-03-28 72/week @ 2019-04-04 40/week @ 2019-04-11

288 downloads per month
Used in 13 crates (6 directly)

MIT license

32KB
617 lines

indextree

Build Status Build status Coverage Status dependency status doc indextree License MIT Crates.io doc.rs

Arena based tree structure with multithreading support

This arena tree structure is using just a single Vec and numerical identifiers (indices in the vector) instead of reference counted pointers. This means there is no RefCell and mutability is handled in a way much more idiomatic to Rust through unique (&mut) access to the arena. The tree can be sent or shared across threads like a Vec. This enables general multiprocessing support like parallel tree traversals.

Example usage

use indextree::Arena;

// Create a new arena
let arena = &mut Arena::new();

// Add some new nodes to the arena
let a = arena.new_node(1);
let b = arena.new_node(2);

// Append a to b
assert!(a.append(b, arena).is_ok());
assert_eq!(b.ancestors(arena).into_iter().count(), 2);

Dependencies

~502KB
~10K SLoC