Enum cranelift_isle::trie_again::Constraint
source · pub enum Constraint {
Variant {
ty: TypeId,
variant: VariantId,
fields: TupleIndex,
},
ConstInt {
val: i128,
ty: TypeId,
},
ConstPrim {
val: Sym,
},
Some,
}
Expand description
Pattern matches which can fail. Some binding sites are the result of successfully matching a constraint. A rule applies constraints to binding sites to determine whether the rule matches.
Variants§
Variant
Fields
ty: TypeId
Which enum type is being matched? This is implied by the binding where the constraint is applied, but recorded here for convenience.
fields: TupleIndex
Number of fields in this variant of this enum. This is recorded in the constraint for convenience, to avoid needing to look up the variant in a sema::TypeEnv.
The value must match this enum variant.
ConstInt
Fields
The value must equal this integer literal.
ConstPrim
The value must equal this Rust primitive value.
Some
The value must be an Option::Some
, from a fallible extractor.
Implementations§
source§impl Constraint
impl Constraint
sourcepub fn bindings_for(self, source: BindingId) -> Vec<Binding>
pub fn bindings_for(self, source: BindingId) -> Vec<Binding>
Return the nested Bindings from matching the given Constraint against the given BindingId.
Trait Implementations§
source§impl Clone for Constraint
impl Clone for Constraint
source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Constraint
impl Debug for Constraint
source§impl Hash for Constraint
impl Hash for Constraint
source§impl Ord for Constraint
impl Ord for Constraint
source§fn cmp(&self, other: &Constraint) -> Ordering
fn cmp(&self, other: &Constraint) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<Constraint> for Constraint
impl PartialEq<Constraint> for Constraint
source§fn eq(&self, other: &Constraint) -> bool
fn eq(&self, other: &Constraint) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<Constraint> for Constraint
impl PartialOrd<Constraint> for Constraint
source§fn partial_cmp(&self, other: &Constraint) -> Option<Ordering>
fn partial_cmp(&self, other: &Constraint) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more