[−][src]Enum libslide::evaluator_rules::rule::Rule
Variants
PatternMap(PatternMap)
Implementations
impl Rule
[src]
pub fn from_fn(f: fn(_: RcExpr) -> Option<RcExpr>) -> Self
[src]
pub fn from_str(s: &str) -> Self
[src]
Trait Implementations
impl Debug for Rule
[src]
impl Display for Rule
[src]
impl Transformer<RcExpr, RcExpr> for Rule
[src]
fn transform(&self, target: RcExpr) -> RcExpr
[src]
Attempts to apply a rule on a target expression by
-
Applying the rule recursively on the target's subexpression to obtain a partially-transformed target expression.
-
Pattern matching the lhs of the rule with the partially-transformed target expression.
- If pattern matching is unsuccessful, no application is done and the original expression is returned.
- Expanding the rhs of the rule using the results of the pattern matching.
Examples:
ⓘThis example is not tested
"$x + 0 -> $x".try_apply("x + 0") // Some(x) "$x + 0 -> $x".try_apply("x + 1") // None "$x + 0 -> $x".try_apply("x") // None
impl Transformer<RcExprPat, RcExprPat> for Rule
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,