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