Expand description
Included from https://github.com/SimonSapin/rust-forest/blob/5783c8be8680b84c0438638bdee07d4e4aca40ac/arena-tree/lib.rs. MIT license (per Cargo.toml).
A DOM-like tree data structure based on &Node
references.
Any non-trivial tree involves reference cycles
(e.g. if a node has a first child, the parent of the child is that node).
To enable this, nodes need to live in an arena allocator
such as arena::TypedArena
distributed with rustc (which is #[unstable]
as of this writing)
or typed_arena::Arena
.
If you need mutability in the node’s data
,
make it a cell (Cell
or RefCell
) or use cells inside of it.
Structs§
- Ancestors
- An iterator of references to the ancestors a given node.
- 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.
- Following
Siblings - An iterator of references to the siblings after a given node.
- Node
- A node inside a DOM-like tree.
- Preceding
Siblings - An iterator of references to the siblings before a given node.
- Reverse
Children - An iterator of references to the children of a given node, in reverse order.
- Reverse
Traverse - An iterator of the start and end edges of a given node and its descendants, in reverse tree order.
- Traverse
- An iterator of the start and end edges of a given node and its descendants, in tree order.
Enums§
- Node
Edge - An edge of the node graph returned by a traversal iterator.