Skip to main content

ShapeVisitor

Trait ShapeVisitor 

Source
pub trait ShapeVisitor {
    // Required method
    fn enter(&mut self, path: &Path, shape: &'static Shape) -> VisitDecision;

    // Provided method
    fn leave(&mut self, path: &Path, shape: &'static Shape) { ... }
}
Expand description

Visitor trait for shape-only traversal.

Implement this trait to receive callbacks as walk_shape descends through a Shape tree.

Required Methods§

Source

fn enter(&mut self, path: &Path, shape: &'static Shape) -> VisitDecision

Called when the walker enters a node, before visiting children.

Return a VisitDecision to control whether children are visited.

Provided Methods§

Source

fn leave(&mut self, path: &Path, shape: &'static Shape)

Called when the walker leaves a node, after visiting children (or after skipping them if enter returned VisitDecision::SkipChildren).

Not called if enter returned VisitDecision::Stop.

Implementors§