MCPcopy Create free account
hub / github.com/argumentcomputer/ix / mdata

Method mdata

crates/common/src/env.rs:931–941  ·  view source on GitHub ↗

Constructs a metadata-annotated expression.

(xs: Vec<(Name, DataValue)>, e: Expr)

Source from the content-addressed store, hash-verified

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 }

Callers 2

egress_exprFunction · 0.45
kexpr_to_leanFunction · 0.45

Calls 6

hash_data_valueFunction · 0.85
as_bytesMethod · 0.80
get_hashMethod · 0.80
finalizeMethod · 0.80
ExprClass · 0.70
lenMethod · 0.45

Tested by

no test coverage detected