Skip to main content

Module structural_visit

Module structural_visit 

Source
Expand description

Native Rust structural visiting.

Two public layers mirror the C++ API split:

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§

VisitCallbacks
A reusable callback visitor with shared user state.
VisitContext
State and recursive operations available to a visit callback.
VisitInterrupt
Interrupt state of a traversal, mirroring C++ ffi.VisitInterrupt.
VisitValue
A borrowed view of a raw tvm-ffi value passed to structural-visit callbacks.

Enums§

DefRegionKind
Definition-region state active at the current value.
WalkOrder
Callback order for structural_walk.
WalkResult
What a callback asks the Rust walker to do with the current value.

Traits§

IntoVisitor
Conversion into the visitor argument accepted by structural_visit.
IntoWalkResult
Convert either an infallible or fallible typed handler result.
IntoWalker
Conversion into the walker argument of structural_walk.
StructuralVisitor
A visitor that controls its own recursion.
VisitChainLink
One link in a first-match visitor callback chain.
WalkChainLink
One link in a first-match structural_walk callback chain.

Functions§

structural_visit
Visit root with a StructuralVisitor or typed callback chain.
structural_walk
Walk root with an observer, the Rust analog of C++ StructuralWalk<order>(root, callbacks...).