pub struct RecExpr<L> { /* fields omitted */ }
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.
If the serde-1
feature is enabled, this implements
[serde::Serialize
][https://docs.rs/serde/latest/serde/trait.Serialize.html].
Adds a given enode to this RecExpr
.
The enode’s children Id
s must refer to elements already in this list.
Checks if this expr is a DAG, i.e. doesn’t have any back edges
Pretty print with a maximum line length.
This gives you a nice, indented, pretty-printed s-expression.
let e: RecExpr<SymbolLang> = "(* (+ 2 2) (+ x y))".parse().unwrap();
assert_eq!(e.pretty(10), "
(*
(+ 2 2)
(+ x y))
".trim());
Returns a new PatternAst
with the variables renames canonically
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
The type returned in the event of a conversion error.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.