pub struct Hasher { /* private fields */ }Expand description
Incremental BLAKE3 hasher.
Wraps blake3::Hasher so callers don’t need to depend on the blake3
crate directly. Use Hasher::update in any order to mix in inputs;
the resulting CacheKey is deterministic for a given sequence of
updates.
Implementations§
Source§impl Hasher
impl Hasher
pub fn new() -> Self
pub fn update(&mut self, bytes: &[u8]) -> &mut Self
Sourcepub fn update_u32(&mut self, value: u32) -> &mut Self
pub fn update_u32(&mut self, value: u32) -> &mut Self
Mix in a u32 in little-endian. Useful for embedding numeric
discriminants (target arch, opt level, schema version, …) into a
key without committing to a string encoding.
Sourcepub fn update_u64(&mut self, value: u64) -> &mut Self
pub fn update_u64(&mut self, value: u64) -> &mut Self
Mix in a u64 in little-endian.
Sourcepub fn update_str(&mut self, s: &str) -> &mut Self
pub fn update_str(&mut self, s: &str) -> &mut Self
Mix in a length-prefixed byte string. Use this instead of bare
update when concatenating multiple variable-length fields, so that
("ab", "c") and ("a", "bc") don’t collide.
pub fn finalize(self) -> CacheKey
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Hasher
impl RefUnwindSafe for Hasher
impl Send for Hasher
impl Sync for Hasher
impl Unpin for Hasher
impl UnsafeUnpin for Hasher
impl UnwindSafe for Hasher
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