pub struct Hash32(/* private fields */);Expand description
256-bit (32-byte) content hash.
Used as a content-addressed identifier for HNSW checkpoints and other snapshot artifacts. The underlying algorithm is caller-defined; the type carries the raw bytes without encoding assumptions.
Implementations§
Source§impl Hash32
impl Hash32
Sourcepub const fn from_bytes(bytes: [u8; 32]) -> Self
pub const fn from_bytes(bytes: [u8; 32]) -> Self
Construct from raw bytes.
Sourcepub fn eq_ct(&self, other: &Self) -> bool
pub fn eq_ct(&self, other: &Self) -> bool
Constant-time equality check.
Accumulates XOR over all 32 bytes without early exit so the comparison
takes the same number of iterations regardless of where bytes differ.
Suitable for integrity comparisons where timing side-channels are a
concern. The #[inline(never)] attribute discourages the compiler from
inlining and optimising away the full-loop traversal.
Trait Implementations§
impl Copy for Hash32
impl Eq for Hash32
Source§impl Ord for Hash32
impl Ord for Hash32
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
Source§impl PartialOrd for Hash32
impl PartialOrd for Hash32
impl StructuralPartialEq for Hash32
Auto Trait Implementations§
impl Freeze for Hash32
impl RefUnwindSafe for Hash32
impl Send for Hash32
impl Sync for Hash32
impl Unpin for Hash32
impl UnsafeUnpin for Hash32
impl UnwindSafe for Hash32
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