Trait exprz::Expression [−][src]
Expression Trait
Associated Types
Loading content...Required methods
fn cases(&self) -> ExprRef<'_, Self>
[src]
Returns a reference to the underlying Expression
type.
fn from_atom(atom: Self::Atom) -> Self
[src]
Builds an Expression
from an atomic element.
fn from_group(group: Self::Group) -> Self
[src]
Builds an Expression
from a grouped expression.
Provided methods
#[must_use]fn from_expr(expr: Expr<Self>) -> Self
[src]
Converts from the canonical enumeration.
fn from_str(s: &str) -> Result<Self, FromCharactersParseError> where
Self::Atom: FromIterator<char>,
Self::Group: FromIterator<Self>,
[src]
Self::Atom: FromIterator<char>,
Self::Group: FromIterator<Self>,
parse
only.Parses a string into an Expression
.
#[must_use]fn is_atom(&self) -> bool
[src]
Checks if the Expression
is atomic.
#[must_use]fn is_group(&self) -> bool
[src]
Checks if the Expression
is a grouped expression.
#[must_use]fn atom(self) -> Option<Self::Atom>
[src]
Converts from an Expression
to an
Option
<
E::Atom
>
.
#[must_use]fn atom_ref(&self) -> Option<&Self::Atom>
[src]
Converts from an &Expression
to an
Option
<
&Expression::Atom
>
.
#[must_use]fn group(self) -> Option<Self::Group>
[src]
Converts from an Expression
to an
Option
<
Expression::Group
>
.
#[must_use]fn group_ref(&self) -> Option<GroupRef<'_, Self>>
[src]
Converts from an &Expression
to an
Option
<
GroupRef
>
.
fn default_atom<T>() -> Self::Atom where
Self::Atom: FromIterator<T>,
[src]
Self::Atom: FromIterator<T>,
Builds an empty atomic expression.
fn default_group() -> Self::Group where
Self::Group: FromIterator<Self>,
[src]
Self::Group: FromIterator<Self>,
Builds an empty grouped expression.
fn empty() -> Self where
Self::Group: FromIterator<Self>,
[src]
Self::Group: FromIterator<Self>,
Returns the default value of an Expression
: the empty group.
fn empty_atom<T>() -> Self where
Self::Atom: FromIterator<T>,
[src]
Self::Atom: FromIterator<T>,
Builds an empty atomic expression.
fn empty_group() -> Self where
Self::Group: FromIterator<Self>,
[src]
Self::Group: FromIterator<Self>,
Builds an empty grouped expression.
fn clone(&self) -> Self where
Self::Atom: Clone,
Self::Group: FromIterator<Self>,
[src]
Self::Atom: Clone,
Self::Group: FromIterator<Self>,
Clones an Expression
that has Clone
-able Atoms
.
fn eq<E>(&self, other: &E) -> bool where
E: Expression,
Self::Atom: PartialEq<E::Atom>,
[src]
E: Expression,
Self::Atom: PartialEq<E::Atom>,
Checks 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::Atom>,
[src]
E: Expression,
Self::Atom: PartialEq<E::Atom>,
Checks if an Expression
is a sub-tree of another Expression
using
PartialEq
on their Atoms
.
fn matches<P>(&self, pattern: P) -> bool where
P: Pattern<Self>,
[src]
P: Pattern<Self>,
pattern
only.Checks if expression matches given Pattern
.
fn matches_equal<P>(&self, pattern: &P) -> bool where
P: Expression,
P::Atom: PartialEq<Self::Atom>,
[src]
P: Expression,
P::Atom: PartialEq<Self::Atom>,
pattern
only.Checks if self
matches an equality pattern.
fn matches_subexpression<P>(&self, pattern: &P) -> bool where
P: Expression,
P::Atom: PartialEq<Self::Atom>,
[src]
P: Expression,
P::Atom: PartialEq<Self::Atom>,
pattern
only.Checks if self
matches a subexpression pattern.
fn matches_basic_shape<P>(&self, pattern: &P) -> bool where
P: Expression<Atom = BasicShape>,
P::Atom: PartialEq<Self::Atom>,
[src]
P: Expression<Atom = BasicShape>,
P::Atom: PartialEq<Self::Atom>,
pattern
only.Checks if self
matches a basic shape pattern.
fn matches_wildcard<W, P>(&self, is_wildcard: W, pattern: &P) -> bool where
P: Expression,
P::Atom: PartialEq<Self::Atom>,
W: Fn(&P::Atom) -> bool,
[src]
P: Expression,
P::Atom: PartialEq<Self::Atom>,
W: Fn(&P::Atom) -> bool,
pattern
only.Checks if self
matches a wildcard expression.
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,
Extends a function on Atoms
to a
function on Expressions
.
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,
Extends a function on &Atoms
to a
function on &Expressions
.
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,
Substitutes 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,
[src]
Self::Group: FromIterator<Self>,
F: FnMut(&Self::Atom) -> Self,
Substitutes an Expression
into each &Atom
of &self
.
Implementors
impl<A> Expression for exprz::vec::Expr<A>
[src]
alloc
only.type Atom = A
type Group = Vec<Self>
fn cases(&self) -> ExprRef<'_, Self>
[src]
fn from_atom(atom: Self::Atom) -> Self
[src]
fn from_group(group: Self::Group) -> Self
[src]
impl<A, G> Expression for MultiExpr<A, G>
[src]
multi
and alloc
only.type Atom = A
type Group = (Vec<Self>, G)
fn cases(&self) -> ExprRef<'_, Self>
[src]
fn from_atom(atom: Self::Atom) -> Self
[src]
fn from_group(group: Self::Group) -> Self
[src]
impl<T> Expression for exprz::buffered::Expr<T>
[src]
buffered
only.