Expand description
Shape-only visitor API for deterministic traversal of Shape trees.
This module provides a visitor pattern for walking the static type structure
described by Shape, emitting Path context at each node. It traverses
only the type metadata — no values are inspected.
§Traversal order
- Depth-first, declaration order. Struct fields are visited in the order they appear in the source. Enum variants are visited in declaration order, and within each variant, fields follow the same rule.
enteris called before children;leaveis called after children (only ifenterreturnedVisitDecision::Recurse).
§Traversal control
VisitDecision returned from ShapeVisitor::enter controls descent:
| Decision | Effect |
|---|---|
Recurse | Visit children, then call leave. |
SkipChildren | Skip descendants of this node; leave is still called. |
Stop | Terminate the entire walk immediately. |
§Cycle handling
Recursive types (e.g. a tree node whose children are Vec<Node>) would cause
infinite descent. The walker tracks ancestor types by ConstTypeId and
does not recurse into a type that is already on the current path. When a
cycle is detected the node is still reported to enter/leave, but its
children are skipped automatically — the visitor does not need to handle this.
Enums§
- Visit
Decision - Decision returned by
ShapeVisitor::enterto control traversal. - Walk
Status - Outcome of
walk_shape.
Traits§
- Shape
Visitor - Visitor trait for shape-only traversal.
Functions§
- walk_
shape - Walk a
Shapetree depth-first, callingvisitorat each node.