Skip to main content

Visitor

Trait Visitor 

Source
pub trait Visitor {
    type Output;
    type Err;

    // Required method
    fn finish(self) -> Result<Self::Output, Self::Err>;

    // Provided methods
    fn enter(&mut self, _node: Cursor<'_>) -> Result<Flow, Self::Err> { ... }
    fn leave(&mut self, _node: Cursor<'_>) -> Result<(), Self::Err> { ... }
}

Required Associated Types§

Required Methods§

Source

fn finish(self) -> Result<Self::Output, Self::Err>

Consume the visitor and return its output.

§Errors

Implementations may return their visitor-specific error.

Provided Methods§

Source

fn enter(&mut self, _node: Cursor<'_>) -> Result<Flow, Self::Err>

Called before visiting a node’s children.

§Errors

Implementations may return their visitor-specific error.

Source

fn leave(&mut self, _node: Cursor<'_>) -> Result<(), Self::Err>

Called after visiting a node’s children.

§Errors

Implementations may return their visitor-specific error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§