Skip to main content

NodeVisitor

Trait NodeVisitor 

Source
pub trait NodeVisitor<D: LayoutDom + ?Sized> {
    type Stop;

    // Provided methods
    fn enter(
        &mut self,
        _dom: &D,
        _id: D::NodeId,
    ) -> ControlFlow<Self::Stop, Descent> { ... }
    fn exit(&mut self, _dom: &D, _id: D::NodeId) -> ControlFlow<Self::Stop> { ... }
}
Expand description

Visitor over a LayoutDom. Methods return ControlFlow so the visitor can bail early with a typed Stop value. Use type Stop = () for plain “stop or not”; use core::convert::Infallible to assert the walk never terminates early; use a typed error type to carry per-node-failure data out of the walk.

Required Associated Types§

Source

type Stop

Early-termination payload carried out of the walk.

Provided Methods§

Source

fn enter( &mut self, _dom: &D, _id: D::NodeId, ) -> ControlFlow<Self::Stop, Descent>

Called when descending into a node. Default: descend.

Source

fn exit(&mut self, _dom: &D, _id: D::NodeId) -> ControlFlow<Self::Stop>

Called after a node’s subtree has been visited. Default: continue.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§