pub enum Constraint {
Variant {
ty: TypeId,
variant: VariantId,
fields: TupleIndex,
},
ConstBool {
val: bool,
ty: TypeId,
},
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
The value must match this enum 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.
ConstBool
The value must equal this boolean literal.
ConstInt
The value must equal this integer literal.
Fields
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 more