Expand description
Visitor support for recursive data types.
Recursive types can implement the VisitChildren trait, to
specify how their recursive entries can be accessed. The extension
trait Visit then adds support for recursively traversing
instances of those types.
§Naming
Visitor methods follow this naming pattern:
[try_]visit_[mut_]{children,post,pre}- The
try-prefix specifies whether the visitor callback is fallible (prefix present) or infallible (prefix omitted). - The
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 childrenpost: recursively visit children in post-orderpre: recursively visit children in pre-order- no suffix: recursively visit children in pre- and post-oder
using a
Visitor` that encapsulates the shared context.
Structs§
Traits§
- TryVisitor
- TryVisitor
Mut - Visit
- A trait for types that can recursively visit their children of the same type.
- Visit
Children - A trait for types that can visit their direct children of type
T. - Visitor
- Visitor
Mut