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
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§
source§impl Rule
impl Rule
sourcepub fn may_overlap(&self, other: &Rule) -> Overlap
pub fn may_overlap(&self, other: &Rule) -> Overlap
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.
sourcepub fn total_constraints(&self) -> usize
pub fn total_constraints(&self) -> usize
Returns the total number of binding sites which this rule constrains, with either a concrete pattern or an equality constraint.
sourcepub fn get_constraint(&self, source: BindingId) -> Option<Constraint>
pub fn get_constraint(&self, source: BindingId) -> Option<Constraint>
Returns the constraint that the given binding site must satisfy for this rule to match, if there is one.