pub struct Rule {
    pub pos: Pos,
    pub equals: DisjointSets<BindingId>,
    pub iterators: StableSet<BindingId>,
    pub prio: i64,
    pub impure: Vec<BindingId>,
    pub result: BindingId,
    /* private fields */
}
Expand description

A term-rewriting rule. All BindingIds are only meaningful in the context of the RuleSet that contains this rule.

Fields§

§pos: Pos

Where was this rule defined?

§equals: DisjointSets<BindingId>

Sets of bindings which must be equal for this rule to match.

§iterators: StableSet<BindingId>

These bindings are from multi-terms which need to be evaluated in this rule.

§prio: i64

If other rules apply along with this one, the one with the highest numeric priority is evaluated. If multiple applicable rules have the same priority, that’s an overlap error.

§impure: Vec<BindingId>

If this rule applies, these side effects should be evaluated before returning.

§result: BindingId

If this rule applies, the top-level term should evaluate to this expression.

Implementations§

Returns whether a given pair of rules can both match on some input, and if so, whether either matches a subset of the other’s inputs. If this function returns No, then the two rules definitely do not overlap. However, it may return Yes in cases where the rules can’t overlap in practice, or where this analysis is not yet precise enough to decide.

Returns the total number of binding sites which this rule constrains, with either a concrete pattern or an equality constraint.

Returns the constraint that the given binding site must satisfy for this rule to match, if there is one.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.