Skip to main content

Traverse

Trait Traverse 

Source
pub trait Traverse {
    // Required methods
    fn flat_map<'a, T, F>(
        &'a self,
        working_set: &'a StateWorkingSet<'_>,
        f: &F,
        results: &mut Vec<T>,
    )
       where F: Fn(&'a Expression) -> Vec<T>;
    fn find_map<'a, T, F>(
        &'a self,
        working_set: &'a StateWorkingSet<'_>,
        f: &F,
    ) -> Option<T>
       where F: Fn(&'a Expression) -> ControlFlow<Option<T>>;
}
Expand description

Trait for traversing the AST

Required Methods§

Source

fn flat_map<'a, T, F>( &'a self, working_set: &'a StateWorkingSet<'_>, f: &F, results: &mut Vec<T>, )
where F: Fn(&'a Expression) -> Vec<T>,

Generic function that do flat_map on an AST node. Concatenates all recursive results on sub-expressions into the results accumulator.

§Arguments
  • f - function that generates leaf elements
  • results - accumulator
Source

fn find_map<'a, T, F>( &'a self, working_set: &'a StateWorkingSet<'_>, f: &F, ) -> Option<T>
where F: Fn(&'a Expression) -> ControlFlow<Option<T>>,

Generic function that do find_map on an AST node. Return the first result found by applying f on sub-expressions.

§Arguments
  • f - function that overrides the default behavior

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§