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) -> FindMapResult<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) -> FindMapResult<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", so this trait is not object safe.

Implementors§