Look up the index for a hash, returning an error if not found. This is a convenience method that wraps [`lookup`](Self::lookup) and converts `None` to [`FormatError::HashNotFound`]. # Arguments `hash` - The 32-byte hash to look up. # Errors - [`FormatError::HashNotFound`] if the hash isn't in the table. # Examples ```rust use atomic_core::change::format_v3::HashDedupTable; let self_hash =
(&self, hash: &[u8; 32])
| 328 | /// assert!(table.require(&[99u8; 32]).is_err()); |
| 329 | /// ``` |
| 330 | pub fn require(&self, hash: &[u8; 32]) -> FormatResult<HashIndex> { |
| 331 | self.lookup(hash).ok_or_else(|| FormatError::HashNotFound { |
| 332 | hash: data_encoding::BASE32_NOPAD.encode(&hash[..8]), |
| 333 | }) |
| 334 | } |
| 335 | |
| 336 | /// Resolve an index back to its 32-byte hash. |
| 337 | /// |