#tree #arena #index #indextree #trie

indextree

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

19 stable releases (4 major)

4.4.0 Mar 8, 2022
4.3.1 Sep 7, 2020
4.2.0 Jun 22, 2020
4.0.0 Aug 4, 2019
0.1.1 Dec 22, 2016

#77 in Data structures

Download history 1831/week @ 2022-03-05 1674/week @ 2022-03-12 1479/week @ 2022-03-19 1236/week @ 2022-03-26 1763/week @ 2022-04-02 2279/week @ 2022-04-09 1705/week @ 2022-04-16 2016/week @ 2022-04-23 1855/week @ 2022-04-30 2150/week @ 2022-05-07 2038/week @ 2022-05-14 1056/week @ 2022-05-21 2304/week @ 2022-05-28 1801/week @ 2022-06-04 1129/week @ 2022-06-11 1001/week @ 2022-06-18

6,316 downloads per month
Used in 38 crates (18 directly)

MIT license

84KB
995 lines

indextree

GitHub Actions 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–435KB