Struct egg::SymbolLang
source · pub struct SymbolLang {
pub op: Symbol,
pub children: Vec<Id>,
}
Expand description
A simple language used for testing.
Fields§
§op: Symbol
The operator for an enode
children: Vec<Id>
The enode’s children Id
s
Implementations§
Trait Implementations§
source§impl Clone for SymbolLang
impl Clone for SymbolLang
source§fn clone(&self) -> SymbolLang
fn clone(&self) -> SymbolLang
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 Debug for SymbolLang
impl Debug for SymbolLang
source§impl<'de> Deserialize<'de> for SymbolLang
impl<'de> Deserialize<'de> for SymbolLang
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for SymbolLang
impl Display for SymbolLang
source§impl FromOp for SymbolLang
impl FromOp for SymbolLang
source§impl Hash for SymbolLang
impl Hash for SymbolLang
source§impl Language for SymbolLang
impl Language for SymbolLang
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 Ord for SymbolLang
impl Ord for SymbolLang
source§fn cmp(&self, other: &SymbolLang) -> Ordering
fn cmp(&self, other: &SymbolLang) -> 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 PartialEq<SymbolLang> for SymbolLang
impl PartialEq<SymbolLang> for SymbolLang
source§fn eq(&self, other: &SymbolLang) -> bool
fn eq(&self, other: &SymbolLang) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<SymbolLang> for SymbolLang
impl PartialOrd<SymbolLang> for SymbolLang
source§fn partial_cmp(&self, other: &SymbolLang) -> Option<Ordering>
fn partial_cmp(&self, other: &SymbolLang) -> 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 moresource§impl Serialize for SymbolLang
impl Serialize for SymbolLang
impl Eq for SymbolLang
impl StructuralEq for SymbolLang
impl StructuralPartialEq for SymbolLang
Auto Trait Implementations§
impl RefUnwindSafe for SymbolLang
impl Send for SymbolLang
impl Sync for SymbolLang
impl Unpin for SymbolLang
impl UnwindSafe for SymbolLang
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.