Visitor support for recursive data types.
Recursive types can implement the
VisitChildren trait, to
specify how their recursive entries can be accessed. The extension
Visit then adds support for recursively traversing
instances of those types.
Visitor methods follow this naming pattern:
try-prefix specifies whether the visitor callback is fallible (prefix present) or infallible (prefix omitted).
mut-suffix specifies whether the visitor callback gets access to mutable (prefix present) or immutable (prefix omitted) child references.
- The final suffix determines the nature of the traversal:
children: only visit direct children
post: recursively visit children in post-order
pre: recursively visit children in pre-order
- no suffix: recursively visit children in pre- and post-oder
Visitor` that encapsulates the shared context.
- A trait for types that can recursively visit their children of the same type.
- A trait for types that can visit their direct children of type