rue_typing/
check.rs

1use std::fmt;
2
3mod attributes;
4mod check_error;
5mod check_type;
6mod simplify_and;
7mod simplify_check;
8mod simplify_or;
9mod stringify_check;
10
11pub use check_error::*;
12
13pub(crate) use attributes::*;
14pub(crate) use check_type::*;
15pub(crate) use simplify_and::*;
16pub(crate) use simplify_check::*;
17pub(crate) use simplify_or::*;
18pub(crate) use stringify_check::*;
19
20use num_bigint::BigInt;
21
22#[derive(Debug, Clone, PartialEq, Eq)]
23pub enum Check {
24    True,
25    False,
26    IsPair,
27    IsAtom,
28    Value(BigInt),
29    Length(usize),
30    And(Vec<Check>),
31    Or(Vec<Check>),
32    If(Box<Check>, Box<Check>, Box<Check>),
33    First(Box<Check>),
34    Rest(Box<Check>),
35}
36
37impl fmt::Display for Check {
38    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39        stringify_check(self, f, &mut Vec::new())
40    }
41}