[−][src]Trait exprz::Expression
Expression Tree
Associated Types
Loading content...Required methods
fn cases(&self) -> ExprRef<'_, Self>
Get a reference to the underlying Expression type.
fn from_atom(atom: Self::Atom) -> Self
Build an Expression from an atomic element.
fn from_group(group: Self::Group) -> Self
Build an Expression from a grouped expression.
Provided methods
#[must_use]fn from_expr(expr: Expr<Self>) -> Self
Convert from the canonical enumeration.
fn from_str(s: &str) -> Result<Self, Error> where
Self::Atom: FromIterator<char>,
Self::Group: FromIterator<Self>,
Self::Atom: FromIterator<char>,
Self::Group: FromIterator<Self>,
Parse a string into an Expression.
#[must_use]fn is_atom(&self) -> bool
Check if the Expression is atomic.
#[must_use]fn is_group(&self) -> bool
Check if the Expression is a grouped expression.
#[must_use]fn atom(self) -> Option<Self::Atom>
Converts from an Expression to an Option<E::Atom>.
#[must_use]fn group(self) -> Option<Self::Group>
Converts from an Expression to an Option<E::Group>.
fn unwrap_atom(self) -> Self::Atom
Returns the contained Atom value, consuming the self value.
Panics
Panics if the self value is a Group.
fn unwrap_group(self) -> Self::Group
Returns the contained Group value, consuming the self value.
Panics
Panics if the self value is an Atom.
fn empty_atom<T>() -> Self where
Self::Atom: FromIterator<T>,
Self::Atom: FromIterator<T>,
Build an empty atomic expression.
fn empty_group() -> Self where
Self::Group: FromIterator<Self>,
Self::Group: FromIterator<Self>,
Build an empty grouped expression.
fn default() -> Self where
Self::Group: FromIterator<Self>,
Self::Group: FromIterator<Self>,
Get the default value of an Expression: the empty group.
fn clone(&self) -> Self where
Self::Atom: Clone,
Self::Group: FromIterator<Self>,
Self::Atom: Clone,
Self::Group: FromIterator<Self>,
Clone an Expression that has Clone-able Atoms.
fn eq<E>(&self, other: &E) -> bool where
E: Expression,
Self::Atom: PartialEq<<E as Expression>::Atom>,
E: Expression,
Self::Atom: PartialEq<<E as Expression>::Atom>,
Check if two Expressions are equal using PartialEq on their Atoms.
fn is_subexpression<E>(&self, other: &E) -> bool where
E: Expression,
Self::Atom: PartialEq<<E as Expression>::Atom>,
E: Expression,
Self::Atom: PartialEq<<E as Expression>::Atom>,
Check if an Expression is a sub-tree of another Expression using PartialEq on their
Atoms.
fn map<E, F>(self, f: F) -> E where
E: Expression,
F: FnMut(Self::Atom) -> <E as Expression>::Atom,
Self::Group: IntoIterator,
<E as Expression>::Group: FromIterator<E>,
<Self::Group as IntoIterator>::Item == Self,
E: Expression,
F: FnMut(Self::Atom) -> <E as Expression>::Atom,
Self::Group: IntoIterator,
<E as Expression>::Group: FromIterator<E>,
<Self::Group as IntoIterator>::Item == Self,
Extend a function on Atoms to a function on Expressions.
fn map_ref<E, F>(&self, f: F) -> E where
E: Expression,
F: FnMut(&Self::Atom) -> <E as Expression>::Atom,
<E as Expression>::Group: FromIterator<E>,
E: Expression,
F: FnMut(&Self::Atom) -> <E as Expression>::Atom,
<E as Expression>::Group: FromIterator<E>,
Extend a function on &Atoms to a function on &Expressions.
fn substitute<F>(self, f: F) -> Self where
F: FnMut(Self::Atom) -> Self,
Self::Group: FromIterator<Self>,
Self::Group: IntoIterator,
<Self::Group as IntoIterator>::Item == Self,
F: FnMut(Self::Atom) -> Self,
Self::Group: FromIterator<Self>,
Self::Group: IntoIterator,
<Self::Group as IntoIterator>::Item == Self,
Substitute an Expression into each Atom of self.
fn substitute_ref<F>(&self, f: F) -> Self where
F: FnMut(&Self::Atom) -> Self,
Self::Group: FromIterator<Self>,
F: FnMut(&Self::Atom) -> Self,
Self::Group: FromIterator<Self>,
Substitute an Expression into each Atom of &self.