MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / resolve

Method resolve

atomic-core/src/change/format_v3/hash_table.rs:357–362  ·  view source on GitHub ↗

Resolve an index back to its 32-byte hash. Returns `None` if the index is out of bounds or is the "none" sentinel ([`HASH_INDEX_NONE`]). # Arguments `index` - The `HashIndex` to resolve. # Examples ```rust use atomic_core::change::format_v3::{HashDedupTable, HASH_INDEX_NONE}; let hash = [42u8; 32]; let table = HashDedupTable::new(hash); assert_eq!(table.resolve(0), Some(&hash)); assert_eq!(

(&self, index: HashIndex)

Source from the content-addressed store, hash-verified

355 /// assert_eq!(table.resolve(HASH_INDEX_NONE), None); // sentinel
356 /// ```
357 pub fn resolve(&self, index: HashIndex) -> Option<&[u8; 32]> {
358 if index == HASH_INDEX_NONE {
359 return None;
360 }
361 self.hashes.get(index as usize)
362 }
363
364 /// Resolve an index back to its hash, returning an error if not found.
365 ///

Callers 3

deserializeMethod · 0.45

Calls 1

getMethod · 0.65