pub struct RecExpr<L> { /* private fields */ }
Expand description
A recursive expression from a user-defined Language
.
This conceptually represents a recursive expression, but it’s actually just a list of enodes.
RecExpr
s must satisfy the invariant that enodes’ children must refer to
elements that come before it in the list. For example, the expression
(+ (* x 5) x)
could be represented by a recursive expression of the form
[Num(5), Var("x"), Mul(1, 0), Add(2, 1)]
.
If the serde-1
feature is enabled, this implements
serde::Serialize
.
Implementations
sourceimpl<L: Language> RecExpr<ENodeOrVar<L>>
impl<L: Language> RecExpr<ENodeOrVar<L>>
sourcepub fn alpha_rename(&self) -> Self
pub fn alpha_rename(&self) -> Self
Returns a new PatternAst
with the variables renames canonically
Trait Implementations
sourceimpl<L: Language> From<RecExpr<ENodeOrVar<L>>> for Pattern<L>
impl<L: Language> From<RecExpr<ENodeOrVar<L>>> for Pattern<L>
sourcefn from(ast: PatternAst<L>) -> Self
fn from(ast: PatternAst<L>) -> Self
Performs the conversion.
sourceimpl<L: Ord> Ord for RecExpr<L>
impl<L: Ord> Ord for RecExpr<L>
sourceimpl<L: PartialOrd> PartialOrd<RecExpr<L>> for RecExpr<L>
impl<L: PartialOrd> PartialOrd<RecExpr<L>> for RecExpr<L>
sourcefn partial_cmp(&self, other: &RecExpr<L>) -> Option<Ordering>
fn partial_cmp(&self, other: &RecExpr<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 RecExpr<L>
impl<L> StructuralEq for RecExpr<L>
impl<L> StructuralPartialEq for RecExpr<L>
Auto Trait Implementations
impl<L> RefUnwindSafe for RecExpr<L> where
L: RefUnwindSafe,
impl<L> Send for RecExpr<L> where
L: Send,
impl<L> Sync for RecExpr<L> where
L: Sync,
impl<L> Unpin for RecExpr<L> where
L: Unpin,
impl<L> UnwindSafe for RecExpr<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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more