Constructs a metadata-annotated expression.
(xs: Vec<(Name, DataValue)>, e: Expr)
| 929 | |
| 930 | /// Constructs a literal expression (nat or string). |
| 931 | pub fn lit(x: Literal) -> Self { |
| 932 | let mut hasher = blake3::Hasher::new(); |
| 933 | match &x { |
| 934 | Literal::NatVal(n) => { |
| 935 | hasher.update(&[ENAT]); |
| 936 | hasher.update(&n.to_le_bytes()); |
| 937 | }, |
| 938 | Literal::StrVal(s) => { |
| 939 | hasher.update(&[ESTR]); |
| 940 | hasher.update(s.as_bytes()); |
| 941 | }, |
| 942 | }; |
| 943 | Expr(Arc::new(ExprData::Lit(x, hasher.finalize()))) |
| 944 | } |