Trait egg::Condition

source ·
pub trait Condition<L, N>where
    L: Language,
    N: Analysis<L>,{
    // Required method
    fn check(
        &self,
        egraph: &mut EGraph<L, N>,
        eclass: Id,
        subst: &Subst
    ) -> bool;

    // Provided method
    fn vars(&self) -> Vec<Var> { ... }
}
Expand description

A condition to check in a ConditionalApplier.

See the ConditionalApplier docs.

Notably, any function (Fn) that doesn’t mutate other state and matches the signature of check implements Condition.

Required Methods§

source

fn check(&self, egraph: &mut EGraph<L, N>, eclass: Id, subst: &Subst) -> bool

Check a condition.

eclass is the eclass Id where the match (subst) occured. If this is true, then the ConditionalApplier will fire.

Provided Methods§

source

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

Returns a list of variables that this Condition assumes are bound.

egg will check that the corresponding Searcher binds those variables. By default this return an empty Vec, which basically turns off the checking.

Implementors§

source§

impl<L, F, N> Condition<L, N> for Fwhere L: Language, N: Analysis<L>, F: Fn(&mut EGraph<L, N>, Id, &Subst) -> bool,

source§

impl<L, N> Condition<L, N> for ConditionEqual<L>where L: Language, N: Analysis<L>,