[][src]Struct libslide::evaluator_rules::rule::PatternMap

pub struct PatternMap {
    pub from: RcExprPat,
    pub to: RcExprPat,
}

A mapping between two expression patterns.

Fields

from: RcExprPatto: RcExprPat

Implementations

impl PatternMap[src]

pub fn from_str(rule: &str) -> Self[src]

Converts a string representation of a rule to a PatternMap. A rule's string form must be

"<expr> -> <expr>"

Where <expr> is an expression pattern.

pub fn bootstrap(&self, bootstrapping_rules: &[Rule]) -> Self[src]

Bootstraps a PatternMap rule with a one-pass application of a rule set, which may include the rule itself.

This allows the rule to match evaluated contexts that cannot be represented by a PatternMap created from just a string form. For example, the rule

"-(_a - _b) -> _b - _a"

in its raw form may only be applied to an expression with explicit parentheses. By bootstrapping this rule with a rule that removes explicit parentheses, the rule can be applied on expressions with implicit parentheses (i.e. of the prefix form (- (- _a _b))).

pub fn validate(&self) -> Result<(), UnresolvedMapping>[src]

Checks a PatternMap is resolvable, returning an error if it is not.

Trait Implementations

impl Clone for PatternMap[src]

impl Debug for PatternMap[src]

impl Display for PatternMap[src]

Auto Trait Implementations

impl RefUnwindSafe for PatternMap

impl Send for PatternMap

impl Sync for PatternMap

impl Unpin for PatternMap

impl UnwindSafe for PatternMap

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> ToString for T where
    T: Display + ?Sized
[src]

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.