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

Method lookup

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

Look up the index for a given hash. Returns `None` if the hash is not in the table. This is an O(1) operation using the internal `HashMap`. # Arguments `hash` - The 32-byte hash to look up. # Examples ```rust use atomic_core::change::format_v3::HashDedupTable; let self_hash = [0u8; 32]; let table = HashDedupTable::new(self_hash); assert_eq!(table.lookup(&self_hash), Some(0)); assert_eq!(tab

(&self, hash: &[u8; 32])

Source from the content-addressed store, hash-verified

300 /// assert_eq!(table.lookup(&[99u8; 32]), None);
301 /// ```
302 pub fn lookup(&self, hash: &[u8; 32]) -> Option<HashIndex> {
303 self.index_map.get(hash).copied()
304 }
305
306 /// Look up the index for a hash, returning an error if not found.
307 ///

Callers 3

serializeMethod · 0.80
requireMethod · 0.80

Calls 1

getMethod · 0.65

Tested by 1