Constructs a name by appending a string component to `pre`.
(pre: Name, s: String)
| 162 | |
| 163 | /// Constructs a name by appending a string component to `pre`. |
| 164 | pub fn str(pre: Name, s: String) -> Self { |
| 165 | let mut hasher = blake3::Hasher::new(); |
| 166 | hasher.update(&[NSTR]); |
| 167 | hasher.update(pre.get_hash().as_bytes()); |
| 168 | hasher.update(s.as_bytes()); |
| 169 | let hash = hasher.finalize(); |
| 170 | Name(Arc::new(NameData::Str(pre, s, hash))) |
| 171 | } |
| 172 | |
| 173 | /// Constructs a name by appending a numeric component to `pre`. |
| 174 | pub fn num(pre: Name, n: Nat) -> Name { |