#tree #arena #index #indextree #trie

indextree

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

16 stable releases (4 major)

4.2.0 Jun 22, 2020
4.0.0 Aug 4, 2019
3.3.0 Jul 9, 2019
3.1.1 Mar 31, 2019
0.1.1 Dec 22, 2016

#25 in Data structures

Download history 433/week @ 2020-04-21 215/week @ 2020-04-28 366/week @ 2020-05-05 358/week @ 2020-05-12 331/week @ 2020-05-19 791/week @ 2020-05-26 404/week @ 2020-06-02 493/week @ 2020-06-09 396/week @ 2020-06-16 708/week @ 2020-06-23 1928/week @ 2020-06-30 4240/week @ 2020-07-07 4679/week @ 2020-07-14 5524/week @ 2020-07-21 3912/week @ 2020-07-28 3363/week @ 2020-08-04

1,616 downloads per month
Used in 24 crates (12 directly)

MIT license

74KB
817 lines

indextree

Build status Build Status Build status Coverage 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

~0–420KB