pub enum Pat<L>{
PatVar(Var),
Wrap(Signature<L, Box<Pat<L>>>),
}Expand description
Recursive AST for patterns in language L.
This can be converted to/from Pattern<AsLanguage<L>>.
User can also define [From<L> for Pat<L>] for concrete L with Self::wrap.
Language derive macro will genrate a newtype wrapper of this type, which implements egg::Searcher and egg::Applier too, and it can have (otherwise orphan) custom instances.
Variants§
Implementations§
Source§impl<L> Pat<L>
impl<L> Pat<L>
Source§impl<L> Pat<L>
impl<L> Pat<L>
Sourcepub fn into_pattern_ast(self) -> PatternAst<AsLanguage<L>>
pub fn into_pattern_ast(self) -> PatternAst<AsLanguage<L>>
Convert a recursive pattern into a PatternAst<L>.
See also: Self::to_pattern_ast.
Sourcepub fn to_pattern_ast(&self) -> PatternAst<AsLanguage<L>>
pub fn to_pattern_ast(&self) -> PatternAst<AsLanguage<L>>
Convert a borrowed recursive pattern to a PatternAst<L>.
See also: Self::into_pattern_ast.
Sourcepub fn from_pattern_ast(ast: &PatternAst<AsLanguage<L>>, id: Id) -> Self
pub fn from_pattern_ast(ast: &PatternAst<AsLanguage<L>>, id: Id) -> Self
Convert a PatternAst<L> into a recursive pattern.
Sourcepub fn add_into_pattern_ast(self, ast: &mut PatternAst<AsLanguage<L>>) -> Id
pub fn add_into_pattern_ast(self, ast: &mut PatternAst<AsLanguage<L>>) -> Id
Adds the pattern into an existing PatternAst and returns the id of the root node. See also: Self::into_pattern_ast, Self::add_to_pattern_ast.
Sourcepub fn add_to_pattern_ast(&self, ast: &mut PatternAst<AsLanguage<L>>) -> Id
pub fn add_to_pattern_ast(&self, ast: &mut PatternAst<AsLanguage<L>>) -> Id
Adds the borrowed pattern into an existing PatternAst and returns the id of the root node. See also: Self::to_pattern_ast, Self::add_into_pattern_ast.
Trait Implementations§
Source§impl<L, N> Applier<<L as Functor>::Container<Id>, N> for Pat<L>
impl<L, N> Applier<<L as Functor>::Container<Id>, N> for Pat<L>
Source§fn apply_one(
&self,
egraph: &mut EGraph<AsLanguage<L>, N>,
eclass: Id,
subst: &Subst,
searcher_ast: Option<&PatternAst<AsLanguage<L>>>,
rule_name: Symbol,
) -> Vec<Id>
fn apply_one( &self, egraph: &mut EGraph<AsLanguage<L>, N>, eclass: Id, subst: &Subst, searcher_ast: Option<&PatternAst<AsLanguage<L>>>, rule_name: Symbol, ) -> Vec<Id>
Source§fn apply_matches(
&self,
egraph: &mut EGraph<L, N>,
matches: &[SearchMatches<'_, L>],
rule_name: GlobalSymbol,
) -> Vec<Id>
fn apply_matches( &self, egraph: &mut EGraph<L, N>, matches: &[SearchMatches<'_, L>], rule_name: GlobalSymbol, ) -> Vec<Id>
Source§fn get_pattern_ast(&self) -> Option<&RecExpr<ENodeOrVar<L>>>
fn get_pattern_ast(&self) -> Option<&RecExpr<ENodeOrVar<L>>>
Source§impl<L> From<&Pat<L>> for PatternAst<AsLanguage<L>>
impl<L> From<&Pat<L>> for PatternAst<AsLanguage<L>>
Source§impl<L> From<Pat<L>> for PatternAst<AsLanguage<L>>
impl<L> From<Pat<L>> for PatternAst<AsLanguage<L>>
Source§impl<L> From<Pattern<<L as Functor>::Container<Id>>> for Pat<L>
impl<L> From<Pattern<<L as Functor>::Container<Id>>> for Pat<L>
Source§fn from(value: Pattern<AsLanguage<L>>) -> Self
fn from(value: Pattern<AsLanguage<L>>) -> Self
Source§impl<L> From<RecExpr<ENodeOrVar<<L as Functor>::Container<Id>>>> for Pat<L>
impl<L> From<RecExpr<ENodeOrVar<<L as Functor>::Container<Id>>>> for Pat<L>
Source§fn from(value: PatternAst<AsLanguage<L>>) -> Self
fn from(value: PatternAst<AsLanguage<L>>) -> Self
Source§impl<L, N> Searcher<<L as Functor>::Container<Id>, N> for Pat<L>
impl<L, N> Searcher<<L as Functor>::Container<Id>, N> for Pat<L>
Source§fn search_eclass_with_limit(
&self,
egraph: &EGraph<AsLanguage<L>, N>,
eclass: Id,
limit: usize,
) -> Option<SearchMatches<'_, AsLanguage<L>>>
fn search_eclass_with_limit( &self, egraph: &EGraph<AsLanguage<L>, N>, eclass: Id, limit: usize, ) -> Option<SearchMatches<'_, AsLanguage<L>>>
Source§fn search_eclass(
&self,
egraph: &EGraph<L, N>,
eclass: Id,
) -> Option<SearchMatches<'_, L>>
fn search_eclass( &self, egraph: &EGraph<L, N>, eclass: Id, ) -> Option<SearchMatches<'_, L>>
Source§fn search(&self, egraph: &EGraph<L, N>) -> Vec<SearchMatches<'_, L>>
fn search(&self, egraph: &EGraph<L, N>) -> Vec<SearchMatches<'_, L>>
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>>
fn search_with_limit( &self, egraph: &EGraph<L, N>, limit: usize, ) -> Vec<SearchMatches<'_, L>>
search, but return at most limit many matches.Source§fn n_matches(&self, egraph: &EGraph<L, N>) -> usize
fn n_matches(&self, egraph: &EGraph<L, N>) -> usize
Source§fn get_pattern_ast(&self) -> Option<&RecExpr<ENodeOrVar<L>>>
fn get_pattern_ast(&self) -> Option<&RecExpr<ENodeOrVar<L>>>
Auto Trait Implementations§
impl<L> Freeze for Pat<L>
impl<L> RefUnwindSafe for Pat<L>
impl<L> Send for Pat<L>
impl<L> Sync for Pat<L>
impl<L> Unpin for Pat<L>
impl<L> UnwindSafe for Pat<L>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more