[−][src]Crate indextree
Arena based tree data structure
This arena tree structure is using just a single Vec
and numerical
identifiers (indices in the vector) instead of reference counted pointers
like. 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 b to a assert!(a.append(b, arena).is_ok()); assert_eq!(b.ancestors(arena).into_iter().count(), 2);
Structs
Ancestors | An iterator of references to the ancestors a given node. |
Arena | An |
Children | An iterator of references to the children of a given node. |
Descendants | An iterator of references to a given node and its descendants, in tree order. |
FollowingSiblings | An iterator of references to the siblings after a given node. |
Node | A node within a particular |
NodeId | A node identifier within a particular |
PrecedingSiblings | An iterator of references to the siblings before a given node. |
ReverseChildren | An iterator of references to the children of a given node, in reverse order. |
ReverseTraverse | An iterator of references to a given node and its descendants, in reverse tree order. |
Traverse | An iterator of references to a given node and its descendants, in tree order. |
Enums
NodeEdge | Indicator if the node is at a start or endpoint of the tree |
NodeError | Possible node failures |