Trait Searcher

Source
pub trait Searcher<L, N>
where L: Language, N: Analysis<L>,
{ // Required methods fn search_eclass_with_limit( &self, egraph: &EGraph<L, N>, eclass: Id, limit: usize, ) -> Option<SearchMatches<'_, L>>; fn vars(&self) -> Vec<Var>; // Provided methods fn search_eclass( &self, egraph: &EGraph<L, N>, eclass: Id, ) -> Option<SearchMatches<'_, L>> { ... } fn search(&self, egraph: &EGraph<L, N>) -> Vec<SearchMatches<'_, L>> { ... } fn search_with_limit( &self, egraph: &EGraph<L, N>, limit: usize, ) -> Vec<SearchMatches<'_, L>> { ... } fn n_matches(&self, egraph: &EGraph<L, N>) -> usize { ... } fn get_pattern_ast(&self) -> Option<&PatternAst<L>> { ... } }
Expand description

The lefthand side of a Rewrite.

A Searcher is something that can search the egraph and find matching substitutions. Right now the only significant Searcher is Pattern.

Required Methods§

Source

fn search_eclass_with_limit( &self, egraph: &EGraph<L, N>, eclass: Id, limit: usize, ) -> Option<SearchMatches<'_, L>>

Similar to search_eclass, but return at most limit many matches.

Implementation of Searcher should implement search_eclass_with_limit.

Source

fn vars(&self) -> Vec<Var>

Returns a list of the variables bound by this Searcher

Provided Methods§

Source

fn search_eclass( &self, egraph: &EGraph<L, N>, eclass: Id, ) -> Option<SearchMatches<'_, L>>

Search one eclass, returning None if no matches can be found. This should not return a SearchMatches with no substs.

Source

fn search(&self, egraph: &EGraph<L, N>) -> Vec<SearchMatches<'_, L>>

Search the whole EGraph, returning a list of all the SearchMatches where something was found. This just calls Searcher::search_with_limit with a big limit.

Source

fn search_with_limit( &self, egraph: &EGraph<L, N>, limit: usize, ) -> Vec<SearchMatches<'_, L>>

Similar to search, but return at most limit many matches.

Source

fn n_matches(&self, egraph: &EGraph<L, N>) -> usize

Returns the number of matches in the e-graph

Source

fn get_pattern_ast(&self) -> Option<&PatternAst<L>>

For patterns, return the ast directly as a reference

Implementors§

Source§

impl<L: Language, A: Analysis<L>> Searcher<L, A> for MultiPattern<L>

Source§

impl<L: Language, A: Analysis<L>> Searcher<L, A> for Pattern<L>