[][src]Trait exprz_core::Expression

pub trait Expression where
    Self: Into<Expr<Self>>, 
{ type Atom; type Group: IntoIteratorGen<Self>; pub fn cases(&self) -> ExprRef<'_, Self>;
pub fn from_atom(atom: Self::Atom) -> Self;
pub fn from_group(group: Self::Group) -> Self; #[must_use] pub fn from_expr(expr: Expr<Self>) -> Self { ... }
pub fn from_str(s: &str) -> Result<Self>
    where
        Self::Atom: FromIterator<char>,
        Self::Group: FromIterator<Self>
, { ... }
#[must_use] pub fn is_atom(&self) -> bool { ... }
#[must_use] pub fn is_group(&self) -> bool { ... }
#[must_use] pub fn atom(self) -> Option<Self::Atom> { ... }
#[must_use] pub fn group(self) -> Option<Self::Group> { ... }
pub fn unwrap_atom(self) -> Self::Atom { ... }
pub fn unwrap_group(self) -> Self::Group { ... }
pub fn empty_atom<T>() -> Self
    where
        Self::Atom: FromIterator<T>
, { ... }
pub fn empty_group() -> Self
    where
        Self::Group: FromIterator<Self>
, { ... }
pub fn default() -> Self
    where
        Self::Group: FromIterator<Self>
, { ... }
pub fn clone(&self) -> Self
    where
        Self::Atom: Clone,
        Self::Group: FromIterator<Self>
, { ... }
pub fn eq<E>(&self, other: &E) -> bool
    where
        E: Expression,
        Self::Atom: PartialEq<E::Atom>
, { ... }
pub fn is_subexpression<E>(&self, other: &E) -> bool
    where
        E: Expression,
        Self::Atom: PartialEq<E::Atom>
, { ... }
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
, { ... }
pub fn map_ref<E, F>(&self, f: F) -> E
    where
        E: Expression,
        E::Group: FromIterator<E>,
        F: FnMut(&Self::Atom) -> E::Atom
, { ... }
pub fn substitute<F>(self, f: F) -> Self
    where
        Self::Group: FromIterator<Self> + IntoIterator<Item = Self>,
        F: FnMut(Self::Atom) -> Self
, { ... }
pub fn substitute_ref<F>(&self, f: F) -> Self
    where
        Self::Group: FromIterator<Self>,
        F: FnMut(&Self::Atom) -> Self
, { ... } }

Expression Tree

Associated Types

type Atom[src]

Atomic Element Type

type Group: IntoIteratorGen<Self>[src]

Group Expression Type

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.

Loading content...

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]

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]

Build an empty atomic expression.

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

Build an empty grouped expression.

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

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

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

Clone an Expression that has Clone-able Atoms.

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

Check if two Expressions are equal using PartialEq on their Atoms.

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

Check if an Expression is a sub-tree of another Expression using PartialEq on their Atoms.

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]

Extend a function on Atoms to a function on Expressions.

pub fn map_ref<E, F>(&self, f: F) -> E where
    E: Expression,
    E::Group: FromIterator<E>,
    F: FnMut(&Self::Atom) -> E::Atom
[src]

Extend a function on &Atoms to a function on &Expressions.

pub fn substitute<F>(self, f: F) -> Self where
    Self::Group: FromIterator<Self> + IntoIterator<Item = Self>,
    F: FnMut(Self::Atom) -> Self, 
[src]

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]

Substitute an Expression into each Atom of &self.

Loading content...

Implementors

Loading content...