Trait exprz::Expression [−][src]
Expression Trait
Associated Types
Loading content...Required methods
fn cases(&self) -> ExprRef<'_, Self>[src]
Get a reference to the underlying Expression type.
fn from_atom(atom: Self::Atom) -> Self[src]
Build an Expression from an atomic element.
fn from_group(group: Self::Group) -> Self[src]
Build an Expression from a grouped expression.
Provided methods
#[must_use]fn from_expr(expr: Expr<Self>) -> Self[src]
Convert from the canonical enumeration.
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 only.Parse a string into an Expression.
#[must_use]fn is_atom(&self) -> bool[src]
Check if the Expression is atomic.
#[must_use]fn is_group(&self) -> bool[src]
Check 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 group(self) -> Option<Self::Group>[src]
Converts from an Expression to an Option<E::Group>.
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.
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.
fn empty_atom<T>() -> Self where
Self::Atom: FromIterator<T>, [src]
Self::Atom: FromIterator<T>,
Build an empty atomic expression.
fn empty_group() -> Self where
Self::Group: FromIterator<Self>, [src]
Self::Group: FromIterator<Self>,
Build an empty grouped expression.
fn default() -> Self where
Self::Group: FromIterator<Self>, [src]
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>, [src]
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::Atom>, [src]
E: Expression,
Self::Atom: PartialEq<E::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::Atom>, [src]
E: Expression,
Self::Atom: PartialEq<E::Atom>,
Check 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.Check 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.Check 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.Check 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.Check 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.Check 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,
Extend 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,
Extend 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,
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, [src]
Self::Group: FromIterator<Self>,
F: FnMut(&Self::Atom) -> Self,
Substitute 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]
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.