rue_hir/types/
constraint.rs1use rue_types::{Check, TypeId};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
4pub enum TypePath {
5 First,
6 Rest,
7}
8
9#[derive(Debug, Clone)]
10#[must_use]
11pub struct Constraint {
12 pub check: Check,
13 pub else_id: Option<TypeId>,
14}
15
16impl Constraint {
17 pub fn new(check: Check) -> Self {
18 Self {
19 check,
20 else_id: None,
21 }
22 }
23
24 pub fn with_else(self, else_id: TypeId) -> Self {
25 Self {
26 else_id: Some(else_id),
27 ..self
28 }
29 }
30}