pub trait Traversal<'t, D: Doc + 't>: Iterator<Item = Node<'t, D>> {
// Required methods
fn calibrate_for_match(&mut self, depth: Option<usize>);
fn get_current_depth(&self) -> usize;
}
Expand description
Traversal can iterate over node by using traversal algorithm.
The next
method should only handle normal, reentrant iteration.
If reentrancy is not desired, traversal should mutate cursor in calibrate_for_match
.
Visit will maintain the matched node depth so traversal does not need to use extra field.
Required Methods§
Sourcefn calibrate_for_match(&mut self, depth: Option<usize>)
fn calibrate_for_match(&mut self, depth: Option<usize>)
Calibrate cursor position to skip overlapping matches. node depth will be passed if matched, otherwise None.
Sourcefn get_current_depth(&self) -> usize
fn get_current_depth(&self) -> usize
Returns the current depth of cursor depth. Cursor depth is incremented by 1 when moving from parent to child. Cursor depth at Root node is 0.