Guide API
Skip to main content

traverse

Function traverse 

Source
pub fn traverse<L, F>(this: &L, action: &mut F)
where L: OutlineViewer + ?Sized, F: FnMut(&L, &Node, i32, i32, i64, u16) -> bool,
Expand description

DFS-visit every currently visible node, calling action for each.

The visitor signature is (this, node, level, position, lines, flags) -> bool, where level is the nesting depth (0 = root), position is the 0-based DFS counter, lines is a bitmask of levels that have a continuation bar, and flags is a combination of OV_EXPANDED, OV_CHILDREN, and OV_LAST. Returning true from action stops the traversal early (like C++ firstThat); returning false visits all nodes (like C++ forEach).

Collapsed subtrees are skipped — only the nodes that are visually present are visited. Use this when you need to count visible nodes, build a row list, or search the visible tree.

§Turbo Vision heritage

Collapses the two C++ methods TOutlineViewer::firstThat (stop on true) and forEach (visit all) into one generic function.