This arena tree structure is using just a single GenerationalArena
and indices
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.
```rust use generational_indextree::Arena;
// Create a new arena let arena = &mut Arena::new();
// Add some new nodes to the arena let a = arena.newnode(1); let b = arena.newnode(2);
// Append a to b assert!(a.append(b, arena).isok()); asserteq!(b.ancestors(arena).into_iter().count(), 2); ```