Struct cranelift_isle::trie_again::Rule

source ·
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§

source§

impl Rule

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl Debug for Rule

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Rule

source§

fn default() -> Rule

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Rule

§

impl RefUnwindSafe for Rule

§

impl Send for Rule

§

impl Sync for Rule

§

impl Unpin for Rule

§

impl UnwindSafe for Rule

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.