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
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.
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 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 for Constraint
impl PartialEq for Constraint
Source§impl PartialOrd for Constraint
impl PartialOrd for Constraint
impl Copy for Constraint
impl Eq for Constraint
impl StructuralPartialEq for Constraint
Auto Trait Implementations§
impl Freeze for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnwindSafe for Constraint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)