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

Method index_to_hash

atomic-core/src/change/format_v3/compact/compactor.rs:267–273  ·  view source on GitHub ↗

Convert a `HashIndex` to an `Option `. - `HASH_INDEX_NONE` → `None` - Valid index → `Some(Hash)`

(&self, index: HashIndex)

Source from the content-addressed store, hash-verified

265 /// - `HASH_INDEX_NONE` → `None`
266 /// - Valid index → `Some(Hash)`
267 pub(super) fn index_to_hash(&self, index: HashIndex) -> FormatResult<Option<Hash>> {
268 if index == HASH_INDEX_NONE {
269 return Ok(None);
270 }
271 let bytes = self.table.resolve_required(index)?;
272 Ok(Some(Hash::from_bytes(*bytes)))
273 }
274}

Callers 3

expand_positionMethod · 0.80
expand_graph_nodeMethod · 0.80
expand_new_edgeMethod · 0.80

Calls 1

resolve_requiredMethod · 0.80

Tested by

no test coverage detected