Resolve an index back to its hash, returning an error if not found. This is a convenience method that wraps [`resolve`](Self::resolve) and converts `None` to [`FormatError::HashIndexOutOfBounds`]. Note: This does NOT error on [`HASH_INDEX_NONE`] — that's a valid sentinel value meaning "no hash." Instead, it returns `None` wrapped in `Ok`. Use [`resolve_required`](Self::resolve_required) if the i
(&self, index: HashIndex)
| 380 | /// - [`FormatError::HashIndexOutOfBounds`] if the index exceeds the table size |
| 381 | /// (and is not `HASH_INDEX_NONE`). |
| 382 | pub fn resolve_or_none(&self, index: HashIndex) -> FormatResult<Option<&[u8; 32]>> { |
| 383 | if index == HASH_INDEX_NONE { |
| 384 | return Ok(None); |
| 385 | } |
| 386 | if (index as usize) >= self.hashes.len() { |
| 387 | return Err(FormatError::HashIndexOutOfBounds { |
| 388 | index, |
| 389 | table_size: self.hashes.len() as u16, |
| 390 | }); |
| 391 | } |
| 392 | Ok(Some(&self.hashes[index as usize])) |
| 393 | } |
| 394 | |
| 395 | /// Resolve an index to a hash, erroring if it's `NONE` or out of bounds. |
| 396 | /// |