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

Method resolve_required

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

Resolve an index to a hash, erroring if it's `NONE` or out of bounds. Unlike [`resolve_or_none`](Self::resolve_or_none), this method treats [`HASH_INDEX_NONE`] as an error. Use this when you need an actual hash (e.g., resolving a dependency index). # Arguments `index` - The `HashIndex` to resolve. # Errors - [`FormatError::HashIndexOutOfBounds`] if the index is `HASH_INDEX_NONE` or exceeds th

(&self, index: HashIndex)

Source from the content-addressed store, hash-verified

407 /// - [`FormatError::HashIndexOutOfBounds`] if the index is `HASH_INDEX_NONE`
408 /// or exceeds the table size.
409 pub fn resolve_required(&self, index: HashIndex) -> FormatResult<&[u8; 32]> {
410 if index == HASH_INDEX_NONE || (index as usize) >= self.hashes.len() {
411 return Err(FormatError::HashIndexOutOfBounds {
412 index,
413 table_size: self.hashes.len() as u16,
414 });
415 }
416 Ok(&self.hashes[index as usize])
417 }
418
419 /// Returns `true` if the table contains the given hash.
420 ///

Calls 1

lenMethod · 0.45