Skip to main content

walk

Function walk 

Source
pub fn walk<'t, F>(root: Node<'t>, visit: &mut F) -> WalkStats
where F: FnMut(Node<'t>),
Expand description

Visit root and all its descendants in pre-order, depth-first.

Iterative and allocation-free: it drives a single tree_sitter::TreeCursor rather than recursing or buffering children. Sibling order is preserved, so the visit sequence matches source order and results are reproducible.

The walk never escapes the subtree rooted at root, even when root has siblings in the wider tree.