Skip to main content

structural_walk

Function structural_walk 

Source
pub fn structural_walk<R, M, H>(
    root: &R,
    walker: H,
    order: WalkOrder,
) -> Result<Option<VisitInterrupt>>
where H: IntoWalker<M>, for<'x> AnyView<'x>: From<&'x R>,
Expand description

Walk root with an observer, the Rust analog of C++ StructuralWalk<order>(root, callbacks...).

walker is anything implementing IntoWalker: a &mut reference to a stateful WalkDispatch walker (#[dispatch(walk)]), a bare closure in any WalkChainLink shape (catch-all &VisitValue, typed, or node, with an optional trailing DefRegionKind), or a tuple of such callbacks tried in order — the C++ callback overloads and variadic chain. The walker owns recursion: the handler runs once per value, before or after the value’s children according to order, and steers traversal through the returned WalkResult.