[][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; #[must_use] 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 default() -> 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 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 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

#[must_use]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.

Panics

Panics if the self value is a Group.

fn unwrap_group(self) -> Self::Group

Returns the contained Group value, consuming the self value.

Panics

Panics if the self value is an Atom.

fn default() -> Self where
    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>, 

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: F) -> E where
    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

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, 

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, 

Substitute an Expression into each Atom of &self.

Loading content...

Implementors

Loading content...