Enum egg::ENodeOrVar
source · pub enum ENodeOrVar<L> {
ENode(L),
Var(Var),
}
Expand description
The language of Pattern
s.
Variants§
Trait Implementations§
source§impl<L: Clone> Clone for ENodeOrVar<L>
impl<L: Clone> Clone for ENodeOrVar<L>
source§fn clone(&self) -> ENodeOrVar<L>
fn clone(&self) -> ENodeOrVar<L>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<L: Debug> Debug for ENodeOrVar<L>
impl<L: Debug> Debug for ENodeOrVar<L>
source§impl<L: FromOp> FromOp for ENodeOrVar<L>
impl<L: FromOp> FromOp for ENodeOrVar<L>
source§impl<L: Hash> Hash for ENodeOrVar<L>
impl<L: Hash> Hash for ENodeOrVar<L>
source§impl<L: Language> Language for ENodeOrVar<L>
impl<L: Language> Language for ENodeOrVar<L>
source§fn 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.source§fn children_mut(&mut self) -> &mut [Id]
fn children_mut(&mut self) -> &mut [Id]
Returns a mutable slice of the children of this e-node.
source§fn 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
.source§fn 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.
source§fn 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.
source§fn 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.
source§fn fold<F, T>(&self, init: T, f: F) -> Twhere
F: FnMut(T, Id) -> T,
T: Clone,
fn fold<F, T>(&self, init: T, f: F) -> Twhere F: FnMut(T, Id) -> T, T: Clone,
Folds over the children, given an initial accumulator.
source§fn 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.
source§fn 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.
source§fn 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]>,
source§fn 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.source§impl<L: Ord> Ord for ENodeOrVar<L>
impl<L: Ord> Ord for ENodeOrVar<L>
source§fn cmp(&self, other: &ENodeOrVar<L>) -> Ordering
fn cmp(&self, other: &ENodeOrVar<L>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<L: PartialEq> PartialEq<ENodeOrVar<L>> for ENodeOrVar<L>
impl<L: PartialEq> PartialEq<ENodeOrVar<L>> for ENodeOrVar<L>
source§fn 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 ==
.source§impl<L: PartialOrd> PartialOrd<ENodeOrVar<L>> for ENodeOrVar<L>
impl<L: PartialOrd> PartialOrd<ENodeOrVar<L>> for ENodeOrVar<L>
source§fn partial_cmp(&self, other: &ENodeOrVar<L>) -> Option<Ordering>
fn partial_cmp(&self, other: &ENodeOrVar<L>) -> Option<Ordering>
1.0.0 · source§fn 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 moreimpl<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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.