Trait Traverse

Source
pub trait Traverse {
    // Required methods
    fn flat_map<'a, T, F>(
        &'a self,
        working_set: &'a StateWorkingSet<'_>,
        f: &F,
    ) -> Vec<T>
       where F: Fn(&'a Expression) -> Option<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, ) -> Vec<T>
where F: Fn(&'a Expression) -> Option<Vec<T>>,

Generic function that do flat_map on an AST node concatenates all recursive results on sub-expressions

§Arguments
  • f - function that overrides the default behavior
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 Some

§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§