Enum egg::ENodeOrVar
source · [−]pub enum ENodeOrVar<L> {
ENode(L),
Var(Var),
}
Expand description
The language of Pattern
s.
Variants
ENode(L)
An enode from the underlying Language
Var(Var)
A pattern variable
Trait Implementations
sourceimpl<L: Clone> Clone for ENodeOrVar<L>
impl<L: Clone> Clone for ENodeOrVar<L>
sourcefn clone(&self) -> ENodeOrVar<L>
fn clone(&self) -> ENodeOrVar<L>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<L: Debug> Debug for ENodeOrVar<L>
impl<L: Debug> Debug for ENodeOrVar<L>
sourceimpl<L: Language + Display> Display for ENodeOrVar<L>
impl<L: Language + Display> Display for ENodeOrVar<L>
sourceimpl<L: FromOp> FromOp for ENodeOrVar<L>
impl<L: FromOp> FromOp for ENodeOrVar<L>
sourceimpl<L: Hash> Hash for ENodeOrVar<L>
impl<L: Hash> Hash for ENodeOrVar<L>
sourceimpl<L: Language> Language for ENodeOrVar<L>
impl<L: Language> Language for ENodeOrVar<L>
sourcefn matches(&self, _other: &Self) -> bool
fn matches(&self, _other: &Self) -> bool
Returns true if this enode matches another enode.
This should only consider the operator, not the children Id
s. Read more
sourcefn children_mut(&mut self) -> &mut [Id]
fn children_mut(&mut self) -> &mut [Id]
Returns a mutable slice of the children of this e-node.
sourcefn for_each_mut<F: FnMut(&mut Id)>(&mut self, f: F)
fn for_each_mut<F: FnMut(&mut Id)>(&mut self, f: F)
Runs a given function on each child Id
, allowing mutation of that Id
.
sourcefn try_for_each<E, F>(&self, f: F) -> Result<(), E> where
F: FnMut(Id) -> Result<(), E>,
E: Clone,
fn try_for_each<E, F>(&self, f: F) -> Result<(), E> where
F: FnMut(Id) -> Result<(), E>,
E: Clone,
Runs a falliable function on each child, stopping if the function returns an error. Read more
sourcefn update_children<F: FnMut(Id) -> Id>(&mut self, f: F)
fn update_children<F: FnMut(Id) -> Id>(&mut self, f: F)
Runs a given function to replace the children.
sourcefn map_children<F: FnMut(Id) -> Id>(self, f: F) -> Self
fn map_children<F: FnMut(Id) -> Id>(self, f: F) -> Self
Creates a new enode with children determined by the given function.
sourcefn fold<F, T>(&self, init: T, f: F) -> T where
F: FnMut(T, Id) -> T,
T: Clone,
fn fold<F, T>(&self, init: T, f: F) -> T where
F: FnMut(T, Id) -> T,
T: Clone,
Folds over the children, given an initial accumulator.
sourcefn all<F: FnMut(Id) -> bool>(&self, f: F) -> bool
fn all<F: FnMut(Id) -> bool>(&self, f: F) -> bool
Returns true if the predicate is true on all children. Does not short circuit. Read more
sourcefn any<F: FnMut(Id) -> bool>(&self, f: F) -> bool
fn any<F: FnMut(Id) -> bool>(&self, f: F) -> bool
Returns true if the predicate is true on any children. Does not short circuit. Read more
sourcefn join_recexprs<F, Expr>(&self, child_recexpr: F) -> RecExpr<Self> where
F: FnMut(Id) -> Expr,
Expr: AsRef<[Self]>,
fn join_recexprs<F, Expr>(&self, child_recexpr: F) -> RecExpr<Self> where
F: FnMut(Id) -> Expr,
Expr: AsRef<[Self]>,
sourcefn build_recexpr<F>(&self, get_node: F) -> RecExpr<Self> where
F: FnMut(Id) -> Self,
fn build_recexpr<F>(&self, get_node: F) -> RecExpr<Self> where
F: FnMut(Id) -> Self,
sourcefn try_build_recexpr<F, Err>(&self, get_node: F) -> Result<RecExpr<Self>, Err> where
F: FnMut(Id) -> Result<Self, Err>,
fn try_build_recexpr<F, Err>(&self, get_node: F) -> Result<RecExpr<Self>, Err> where
F: FnMut(Id) -> Result<Self, Err>,
Same as Language::build_recexpr
, but fallible.
sourceimpl<L: Ord> Ord for ENodeOrVar<L>
impl<L: Ord> Ord for ENodeOrVar<L>
sourceimpl<L: PartialEq> PartialEq<ENodeOrVar<L>> for ENodeOrVar<L>
impl<L: PartialEq> PartialEq<ENodeOrVar<L>> for ENodeOrVar<L>
sourcefn eq(&self, other: &ENodeOrVar<L>) -> bool
fn eq(&self, other: &ENodeOrVar<L>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ENodeOrVar<L>) -> bool
fn ne(&self, other: &ENodeOrVar<L>) -> bool
This method tests for !=
.
sourceimpl<L: PartialOrd> PartialOrd<ENodeOrVar<L>> for ENodeOrVar<L>
impl<L: PartialOrd> PartialOrd<ENodeOrVar<L>> for ENodeOrVar<L>
sourcefn partial_cmp(&self, other: &ENodeOrVar<L>) -> Option<Ordering>
fn partial_cmp(&self, other: &ENodeOrVar<L>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<L: Eq> Eq for ENodeOrVar<L>
impl<L> StructuralEq for ENodeOrVar<L>
impl<L> StructuralPartialEq for ENodeOrVar<L>
Auto Trait Implementations
impl<L> RefUnwindSafe for ENodeOrVar<L> where
L: RefUnwindSafe,
impl<L> Send for ENodeOrVar<L> where
L: Send,
impl<L> Sync for ENodeOrVar<L> where
L: Sync,
impl<L> Unpin for ENodeOrVar<L> where
L: Unpin,
impl<L> UnwindSafe for ENodeOrVar<L> where
L: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.