pub struct Hash(pub [u8; 32]);Expand description
A BLAKE3 content hash (32 bytes / 256 bits).
Used as the canonical identifier for blobs in the content-addressed store. BLAKE3 provides SIMD-accelerated hashing with a 2^128 collision resistance bound.
Tuple Fields§
§0: [u8; 32]The raw 32-byte digest.
Implementations§
Source§impl Hash
impl Hash
Sourcepub fn from_hex(hex: &str) -> Result<Self, HashError>
pub fn from_hex(hex: &str) -> Result<Self, HashError>
Parse a hash from a 64-character lowercase hex string.
Sourcepub fn bucket(&self) -> u8
pub fn bucket(&self) -> u8
The 2-hex-prefix bucket index (0..=255) of this hash in the blob
store layout: blobs live under objects/<2-hex-prefix>/<rest>,
where the 2-hex prefix is the lowercase-hex encoding of this byte
(the digest’s first byte). See BlobStore::blob_path.
This is a pure function of the digest; Kani-verified in
tests/kani.rs to agree with the hex text form and to be stable
under the to_hex/from_hex roundtrip.
Sourcepub fn as_blake3(&self) -> Blake3Hash
pub fn as_blake3(&self) -> Blake3Hash
Convert to a blake3::Hash value.
Trait Implementations§
impl Copy for Hash
impl Eq for Hash
Source§impl From<Hash> for Hash
impl From<Hash> for Hash
Source§fn from(h: Blake3Hash) -> Self
fn from(h: Blake3Hash) -> Self
Converts to this type from the input type.
Source§impl Ord for Hash
impl Ord for Hash
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Hash
impl PartialOrd for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnsafeUnpin for Hash
impl UnwindSafe for Hash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more