Expand description
Native Rust structural visiting.
Two public layers mirror the C++ API split:
StructuralVisitor+structural_visit— the visitor drives recursion itself, like a hand-written C++StructuralVisitorObj:StructuralVisitor::visitruns once per reached value and descends only where it callsStructuralVisitor::default_visit_childrenorStructuralVisitor::visit_child.#[dispatch(visit)]generates this trait from typedvisit_*methods.WalkDispatch+structural_walk— observer callbacks, like C++StructuralWalk: the walker recurses on its own and callbacks steer it through the returnedWalkResult(advance, skip, interrupt).
Both layers thread the definition-region state explicitly: walk handlers
opt in with a trailing DefRegionKind argument, and a visitor receives
and forwards it when descending.
Underneath both, VisitValue provides borrowed matching for typed Rust
dispatch. Rust supplies a temporary ffi.StructuralVisitor ABI object so
every type’s registered __s_visit__ hook can enumerate its children and
call back into the active Rust visitor. Types without a hook fall back to
reflected structural fields, matching the C++ protocol.
Re-exports§
pub use super::dispatch::WalkDispatch;
Structs§
- Visit
Callbacks - A reusable callback visitor with shared user state.
- Visit
Context - State and recursive operations available to a visit callback.
- Visit
Interrupt - Interrupt state of a traversal, mirroring C++
ffi.VisitInterrupt. - Visit
Value - A borrowed view of a raw tvm-ffi value passed to structural-visit callbacks.
Enums§
- DefRegion
Kind - Definition-region state active at the current value.
- Walk
Order - Callback order for
structural_walk. - Walk
Result - What a callback asks the Rust walker to do with the current value.
Traits§
- Into
Visitor - Conversion into the visitor argument accepted by
structural_visit. - Into
Walk Result - Convert either an infallible or fallible typed handler result.
- Into
Walker - Conversion into the walker argument of
structural_walk. - Structural
Visitor - A visitor that controls its own recursion.
- Visit
Chain Link - One link in a first-match visitor callback chain.
- Walk
Chain Link - One link in a first-match
structural_walkcallback chain.
Functions§
- structural_
visit - Visit
rootwith aStructuralVisitoror typed callback chain. - structural_
walk - Walk
rootwith an observer, the Rust analog of C++StructuralWalk<order>(root, callbacks...).