pub struct Hasher { /* private fields */ }
Available on crate feature
xxhash32
only.Expand description
Calculates the 32-bit hash.
§Caution
Although this struct implements hash::Hasher
, it only calculates a
32-bit number, leaving the upper bits as 0. This means it is
unlikely to be correct to use this in places like a HashMap
.
Implementations§
Source§impl Hasher
impl Hasher
Sourcepub fn oneshot(seed: u32, data: &[u8]) -> u32
pub fn oneshot(seed: u32, data: &[u8]) -> u32
Hash all data at once. If you can use this function, you may see noticable speed gains for certain types of input.
Sourcepub const fn total_len_32(&self) -> u32
pub const fn total_len_32(&self) -> u32
The total number of bytes hashed, truncated to 32 bits.
For the full 64-bit byte count, use total_len
.
Sourcepub fn finish_32(&self) -> u32
pub fn finish_32(&self) -> u32
Returns the hash value for the values written so far. Unlike
hash::Hasher::finish
, this method returns the actual 32-bit
value calculated, not a 64-bit value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hasher
Available on crate feature serialize
only.
impl<'de> Deserialize<'de> for Hasher
Available on crate feature
serialize
only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hasher for Hasher
impl Hasher for Hasher
1.26.0 · Source§fn write_u128(&mut self, i: u128)
fn write_u128(&mut self, i: u128)
Writes a single
u128
into this hasher.1.3.0 · Source§fn write_usize(&mut self, i: usize)
fn write_usize(&mut self, i: usize)
Writes a single
usize
into this hasher.1.26.0 · Source§fn write_i128(&mut self, i: i128)
fn write_i128(&mut self, i: i128)
Writes a single
i128
into this hasher.1.3.0 · Source§fn write_isize(&mut self, i: isize)
fn write_isize(&mut self, i: isize)
Writes a single
isize
into this hasher.Source§fn write_length_prefix(&mut self, len: usize)
fn write_length_prefix(&mut self, len: usize)
🔬This is a nightly-only experimental API. (
hasher_prefixfree_extras
)Writes a length prefix into this hasher, as part of being prefix-free. Read more
impl StructuralPartialEq for Hasher
Auto Trait Implementations§
impl Freeze for Hasher
impl RefUnwindSafe for Hasher
impl Send for Hasher
impl Sync for Hasher
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)