[−][src]Struct egg::RecExpr
A recursive expression from a user-defined Language
.
This is type is essentially an ENode
whose children are
RecExpr
s. This is resource counted with Rc
, so it's cheap
to clone.
If the serde-1
feature is enabled, this implements
serde::Serialize
by pretty-printing with
self.pretty(80)
.
Methods
impl<L: Language + Display> RecExpr<L>
[src]
pub fn pretty(&self, width: usize) -> String
[src]
Pretty print with a maximum line length.
This gives you a nice, indented, pretty-printed s-expression.
Example
define_language! { enum FooLanguage { Num(i32), Add = "+", Mul = "*", Symbol(String), } } let e: RecExpr<FooLanguage> = "(* (+ 2 2) (+ x y))".parse().unwrap(); assert_eq!(e.pretty(10), " (* (+ 2 2) (+ x y)) ".trim());
Trait Implementations
impl<L> AsRef<ENode<L, RecExpr<L>>> for RecExpr<L>
[src]
impl<L> Borrow<ENode<L, RecExpr<L>>> for RecExpr<L>
[src]
impl<L: Clone> Clone for RecExpr<L>
[src]
impl<L: Debug> Debug for RecExpr<L>
[src]
impl<L: Eq> Eq for RecExpr<L>
[src]
impl<L> From<ENode<L, RecExpr<L>>> for RecExpr<L>
[src]
impl<L: Language> From<RecExpr<L>> for Pattern<L>
[src]
impl<L: Language + FromStr> FromStr for RecExpr<L>
[src]
type Err = ParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, ParseError>
[src]
impl<L: Hash> Hash for RecExpr<L>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<L: PartialEq> PartialEq<RecExpr<L>> for RecExpr<L>
[src]
impl<L> StructuralEq for RecExpr<L>
[src]
impl<L> StructuralPartialEq for RecExpr<L>
[src]
impl<L: Language> TryFrom<Pattern<L>> for RecExpr<L>
[src]
Auto Trait Implementations
impl<L> !RefUnwindSafe for RecExpr<L>
impl<L> !Send for RecExpr<L>
impl<L> !Sync for RecExpr<L>
impl<L> Unpin for RecExpr<L>
impl<L> !UnwindSafe for RecExpr<L>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,