#tree #arena #index #indextree #trie

indextree

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

18 stable releases (4 major)

4.3.1 Sep 7, 2020
4.2.0 Jun 22, 2020
4.0.0 Aug 4, 2019
3.3.0 Jul 9, 2019
0.1.1 Dec 22, 2016

#40 in Data structures

Download history 289/week @ 2021-02-25 298/week @ 2021-03-04 498/week @ 2021-03-11 303/week @ 2021-03-18 489/week @ 2021-03-25 411/week @ 2021-04-01 464/week @ 2021-04-08 479/week @ 2021-04-15 670/week @ 2021-04-22 493/week @ 2021-04-29 388/week @ 2021-05-06 471/week @ 2021-05-13 742/week @ 2021-05-20 1297/week @ 2021-05-27 459/week @ 2021-06-03 545/week @ 2021-06-10

1,833 downloads per month
Used in 28 crates (14 directly)

MIT license

80KB
946 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–470KB
~10K SLoC