Enum exprz::Expr[][src]

pub enum Expr<E> where
    E: Expression
{ Atom(E::Atom), Group(E::Group), }

Canonical Concrete Expression Type

Variants

Atom(E::Atom)

Atomic element

Group(E::Group)

Grouped expression

Implementations

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

#[must_use]pub fn is_atom(&self) -> bool[src]

Checks if the Expr is atomic.

#[must_use]pub fn is_group(&self) -> bool[src]

Checks if the Expr is a grouped expression.

#[must_use]pub fn atom(self) -> Option<E::Atom>[src]

Converts from an Expr<E> to an Option<E::Atom>.

#[must_use]pub fn group(self) -> Option<E::Group>[src]

Converts from an Expr<E> to an Option<E::Group>.

pub fn unwrap_atom(self) -> E::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) -> E::Group[src]

Returns the contained Group value, consuming the self value.

Panics

Panics if the self value is an Atom.

pub fn map<O, F>(self, f: F) -> O where
    E::Group: IntoIterator<Item = E>,
    O: Expression,
    O::Group: FromIterator<O>,
    F: FnMut(E::Atom) -> O::Atom
[src]

Extends a function on Atoms to a function on Expressions.

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

Substitutes an Expression into each Atom of self.

Trait Implementations

impl<E: Clone> Clone for Expr<E> where
    E: Expression,
    E::Atom: Clone,
    E::Group: Clone
[src]

impl<E: Copy> Copy for Expr<E> where
    E: Expression,
    E::Atom: Copy,
    E::Group: Copy
[src]

impl<E: Debug> Debug for Expr<E> where
    E: Expression,
    E::Atom: Debug,
    E::Group: Debug
[src]

impl<E> Default for Expr<E> where
    E: Expression,
    E::Group: FromIterator<E>, 
[src]

fn default() -> Self[src]

Returns the empty group expression.

impl<E: Eq> Eq for Expr<E> where
    E: Expression,
    E::Atom: Eq,
    E::Group: Eq
[src]

impl<A> From<Expr<A>> for Expr<Expr<A>>[src]

This is supported on crate feature alloc only.

impl<T> From<Expr<T, usize, usize>> for Expr<Expr<T>>[src]

This is supported on crate feature buffered only.

impl<'e, E> From<ExprRef<'e, E>> for Expr<E> where
    E::Atom: Clone,
    E::Group: FromIterator<E>,
    E: Expression
[src]

impl<A, G> From<MultiExpr<A, G>> for Expr<MultiExpr<A, G>>[src]

This is supported on crate feature alloc only.

impl<E> FromStr for Expr<E> where
    E: Expression,
    E::Atom: FromIterator<char>,
    E::Group: FromIterator<E>, 
[src]

This is supported on crate feature parse only.

type Err = Error

The associated error which can be returned from parsing.

impl<E: Hash> Hash for Expr<E> where
    E: Expression,
    E::Atom: Hash,
    E::Group: Hash
[src]

impl<E: PartialEq> PartialEq<Expr<E>> for Expr<E> where
    E: Expression,
    E::Atom: PartialEq,
    E::Group: PartialEq
[src]

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

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

Auto Trait Implementations

impl<E> Send for Expr<E> where
    <E as Expression>::Atom: Send,
    <E as Expression>::Group: Send

impl<E> Sync for Expr<E> where
    <E as Expression>::Atom: Sync,
    <E as Expression>::Group: Sync

impl<E> Unpin for Expr<E> where
    <E as Expression>::Atom: Unpin,
    <E as Expression>::Group: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.