[−][src]Trait exprz_core::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.
#[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 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 Atom
s.
fn eq<E>(&self, other: &E) -> bool where
E: Expression,
Self::Atom: PartialEq<E::Atom>,
E: Expression,
Self::Atom: PartialEq<E::Atom>,
Check if two Expression
s are equal using PartialEq
on their Atom
s.
fn is_subexpression<E>(&self, other: &E) -> bool where
E: Expression,
Self::Atom: PartialEq<E::Atom>,
E: Expression,
Self::Atom: PartialEq<E::Atom>,
Check if an Expression
is a sub-tree of another Expression
using PartialEq
on their
Atom
s.
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,
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.
fn map_ref<E, F>(&self, f: F) -> E where
E: Expression,
E::Group: FromIterator<E>,
F: FnMut(&Self::Atom) -> E::Atom,
E: Expression,
E::Group: FromIterator<E>,
F: FnMut(&Self::Atom) -> E::Atom,
Extend a function on &Atom
s to a function on &Expression
s.
fn substitute<F>(self, f: F) -> Self where
Self::Group: FromIterator<Self> + IntoIterator<Item = Self>,
F: FnMut(Self::Atom) -> Self,
Self::Group: FromIterator<Self> + IntoIterator<Item = Self>,
F: FnMut(Self::Atom) -> Self,
Substitute an Expression
into each Atom
of self
.
fn substitute_ref<F>(&self, f: F) -> Self where
Self::Group: FromIterator<Self>,
F: FnMut(&Self::Atom) -> Self,
Self::Group: FromIterator<Self>,
F: FnMut(&Self::Atom) -> Self,
Substitute an Expression
into each Atom
of &self
.