[][src]Trait exprz_core::Expression

pub trait Expression where
    Self: Into<Expr<Self>>, 
{ type Atom; type Group: IntoIteratorGen<Self>; fn cases(&self) -> ExprRef<'_, Self>;
fn from_atom(atom: Self::Atom) -> Self;
fn from_group(group: Self::Group) -> Self; fn from_expr(expr: Expr<Self>) -> 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 group(self) -> Option<Self::Group> { ... }
fn unwrap_atom(self) -> Self::Atom { ... }
fn unwrap_group(self) -> Self::Group { ... }
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 map<E, F>(self, f: &mut F) -> E
    where
        E: Expression,
        E::Group: FromIterator<E>,
        F: FnMut(Self::Atom) -> E::Atom
, { ... }
fn map_ref<E, F>(&self, f: &mut F) -> E
    where
        E: Expression,
        E::Group: FromIterator<E>,
        F: FnMut(&Self::Atom) -> E::Atom
, { ... }
fn substitute<F>(self, f: &mut F) -> Self
    where
        Self::Group: FromIterator<Self>,
        F: FnMut(Self::Atom) -> Self
, { ... }
fn substitute_from_iter<'s, I>(self, iter: &I) -> Self
    where
        Self::Atom: 's + PartialEq,
        Self::Group: FromIterator<Self>,
        I: IteratorGen<(&'s Self::Atom, Self)>
, { ... }
fn substitute_ref<F>(&self, f: &mut F) -> Self
    where
        Self::Group: FromIterator<Self>,
        F: FnMut(&Self::Atom) -> Self
, { ... }
fn substitute_ref_from_iter<'s, I>(&self, iter: &I) -> Self
    where
        Self: 's,
        Self::Atom: PartialEq + Clone,
        Self::Group: FromIterator<Self>,
        I: IteratorGen<(&'s Self::Atom, &'s Self)>
, { ... } }

Expression Tree

Associated Types

type Atom

Atomic element type

type Group: IntoIteratorGen<Self>

Group expression type

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.

Loading content...

Provided methods

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.

fn unwrap_group(self) -> Self::Group

Returns the contained Group value, consuming the self value.

fn clone(&self) -> Self where
    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>, 

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>, 

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

fn map<E, F>(self, f: &mut F) -> E where
    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: &mut F) -> E where
    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: &mut F) -> Self where
    Self::Group: FromIterator<Self>,
    F: FnMut(Self::Atom) -> Self, 

Substitute an Expression into each Atom of self.

fn substitute_from_iter<'s, I>(self, iter: &I) -> Self where
    Self::Atom: 's + PartialEq,
    Self::Group: FromIterator<Self>,
    I: IteratorGen<(&'s Self::Atom, Self)>, 

Use an iterator generator as a piecewise function to substitute an Expression into each Atom of self.

fn substitute_ref<F>(&self, f: &mut F) -> Self where
    Self::Group: FromIterator<Self>,
    F: FnMut(&Self::Atom) -> Self, 

Substitute an Expression into each Atom of &self.

fn substitute_ref_from_iter<'s, I>(&self, iter: &I) -> Self where
    Self: 's,
    Self::Atom: PartialEq + Clone,
    Self::Group: FromIterator<Self>,
    I: IteratorGen<(&'s Self::Atom, &'s Self)>, 

Use an iterator generator as a piecewise function to substitute an Expression into each Atom of &self.

Loading content...

Implementors

impl<E> Expression for Expr<E> where
    E: Expression
[src]

type Atom = E::Atom

type Group = E::Group

Loading content...