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

Method num

crates/common/src/env.rs:174–181  ·  view source on GitHub ↗

Constructs a name by appending a numeric component to `pre`.

(pre: Name, n: Nat)

Source from the content-addressed store, hash-verified

172
173 /// Constructs a name by appending a numeric component to `pre`.
174 pub fn num(pre: Name, n: Nat) -> Name {
175 let mut hasher = blake3::Hasher::new();
176 hasher.update(&[NNUM]);
177 hasher.update(pre.get_hash().as_bytes());
178 hasher.update(&n.to_le_bytes());
179 let hash = hasher.finalize();
180 Name(Arc::new(NameData::Num(pre, n, hash)))
181 }
182 /// Decompose this name into its components (from root to leaf).
183 pub fn components(&self) -> Vec<NameComponent> {
184 let mut components = Vec::new();

Callers

nothing calls this directly

Calls 4

NameClass · 0.85
as_bytesMethod · 0.80
get_hashMethod · 0.80
finalizeMethod · 0.80

Tested by

no test coverage detected