Trait exprz::Expression[][src]

pub trait Expression where
    Self: Into<Expr<Self>>, 
{ type Atom; type Group: Group<Self>; fn cases(&self) -> ExprRef<'_, Self>;
fn from_atom(atom: Self::Atom) -> Self;
fn from_group(group: Self::Group) -> Self; #[must_use] fn from_expr(expr: Expr<Self>) -> Self { ... }
fn from_str(s: &str) -> Result<Self, FromCharactersParseError>
    where
        Self::Atom: FromIterator<char>,
        Self::Group: FromIterator<Self>
, { ... }
#[must_use] fn is_atom(&self) -> bool { ... }
#[must_use] fn is_group(&self) -> bool { ... }
#[must_use] fn atom(self) -> Option<Self::Atom> { ... }
#[must_use] fn atom_ref(&self) -> Option<&Self::Atom> { ... }
#[must_use] fn group(self) -> Option<Self::Group> { ... }
#[must_use] fn group_ref(&self) -> Option<GroupRef<'_, Self>> { ... }
fn default_atom<T>() -> Self::Atom
    where
        Self::Atom: FromIterator<T>
, { ... }
fn default_group() -> Self::Group
    where
        Self::Group: FromIterator<Self>
, { ... }
fn empty() -> Self
    where
        Self::Group: FromIterator<Self>
, { ... }
fn empty_atom<T>() -> Self
    where
        Self::Atom: FromIterator<T>
, { ... }
fn empty_group() -> Self
    where
        Self::Group: FromIterator<Self>
, { ... }
fn clone(&self) -> Self
    where
        Self::Atom: Clone,
        Self::Group: FromIterator<Self>
, { ... }
fn eq<E>(&self, other: &E) -> bool
    where
        E: Expression,
        Self::Atom: PartialEq<E::Atom>
, { ... }
fn is_subexpression<E>(&self, other: &E) -> bool
    where
        E: Expression,
        Self::Atom: PartialEq<E::Atom>
, { ... }
fn matches<P>(&self, pattern: P) -> bool
    where
        P: Pattern<Self>
, { ... }
fn matches_equal<P>(&self, pattern: &P) -> bool
    where
        P: Expression,
        P::Atom: PartialEq<Self::Atom>
, { ... }
fn matches_subexpression<P>(&self, pattern: &P) -> bool
    where
        P: Expression,
        P::Atom: PartialEq<Self::Atom>
, { ... }
fn matches_basic_shape<P>(&self, pattern: &P) -> bool
    where
        P: Expression<Atom = BasicShape>,
        P::Atom: PartialEq<Self::Atom>
, { ... }
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
, { ... }
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
, { ... }
fn map_ref<E, F>(&self, f: F) -> E
    where
        E: Expression,
        E::Group: FromIterator<E>,
        F: FnMut(&Self::Atom) -> E::Atom
, { ... }
fn substitute<F>(self, f: F) -> Self
    where
        Self::Group: FromIterator<Self> + IntoIterator<Item = Self>,
        F: FnMut(Self::Atom) -> Self
, { ... }
fn substitute_ref<F>(&self, f: F) -> Self
    where
        Self::Group: FromIterator<Self>,
        F: FnMut(&Self::Atom) -> Self
, { ... } }

Expression Trait

Associated Types

type Atom[src]

Atomic Element Type

type Group: Group<Self>[src]

Group Expression Type

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.

Loading content...

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]

This is supported on crate feature 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]

Builds an empty atomic expression.

fn default_group() -> Self::Group where
    Self::Group: FromIterator<Self>, 
[src]

Builds an empty grouped expression.

fn empty() -> Self where
    Self::Group: FromIterator<Self>, 
[src]

Returns the default value of an Expression: the empty group.

fn empty_atom<T>() -> Self where
    Self::Atom: FromIterator<T>, 
[src]

Builds an empty atomic expression.

fn empty_group() -> Self where
    Self::Group: FromIterator<Self>, 
[src]

Builds an empty grouped expression.

fn clone(&self) -> Self where
    Self::Atom: Clone,
    Self::Group: FromIterator<Self>, 
[src]

Clones an Expression that has Clone-able Atoms.

fn eq<E>(&self, other: &E) -> bool where
    E: Expression,
    Self::Atom: PartialEq<E::Atom>, 
[src]

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]

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]

This is supported on crate feature 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]

This is supported on crate feature 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]

This is supported on crate feature 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]

This is supported on crate feature 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]

This is supported on crate feature 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]

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]

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]

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]

Substitutes an Expression into each &Atom of &self.

Loading content...

Implementors

impl<A> Expression for exprz::vec::Expr<A>[src]

This is supported on crate feature alloc only.

type Atom = A

type Group = Vec<Self>

impl<A, G> Expression for MultiExpr<A, G>[src]

This is supported on crate features multi and alloc only.

type Atom = A

type Group = (Vec<Self>, G)

impl<T> Expression for exprz::buffered::Expr<T>[src]

This is supported on crate feature buffered only.

type Atom = Vec<T>

type Group = ExprGroup<T>

Loading content...