pub struct SymbolLang {
pub op: Symbol,
pub children: Vec<Id>,
}Expand description
A simple language used for testing.
Fields§
§op: SymbolThe operator for an enode
children: Vec<Id>The enode’s children Ids
Implementations§
Trait Implementations§
Source§impl Clone for SymbolLang
impl Clone for SymbolLang
Source§fn clone(&self) -> SymbolLang
fn clone(&self) -> SymbolLang
Returns a duplicate 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§type Discriminant = GlobalSymbol
type Discriminant = GlobalSymbol
Type representing the cases of this language. Read more
Source§fn discriminant(&self) -> Self::Discriminant
fn discriminant(&self) -> Self::Discriminant
Return the
Discriminant of this node.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 and the arity,
not the children
Ids.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>
fn try_for_each<E, F>(&self, f: F) -> Result<(), E>
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) -> T
fn fold<F, T>(&self, init: T, f: F) -> T
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>
fn join_recexprs<F, Expr>(&self, child_recexpr: F) -> RecExpr<Self>
Source§fn build_recexpr<F>(&self, get_node: F) -> RecExpr<Self>
fn build_recexpr<F>(&self, get_node: F) -> RecExpr<Self>
Source§fn try_build_recexpr<F, Err>(&self, get_node: F) -> Result<RecExpr<Self>, Err>
fn try_build_recexpr<F, Err>(&self, get_node: F) -> Result<RecExpr<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 for SymbolLang
impl PartialEq for SymbolLang
Source§impl PartialOrd for SymbolLang
impl PartialOrd for SymbolLang
Source§impl Serialize for SymbolLang
impl Serialize for SymbolLang
impl Eq for SymbolLang
impl StructuralPartialEq for SymbolLang
Auto Trait Implementations§
impl Freeze for SymbolLang
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.