pub struct XxHash3_64 { /* private fields */ }Expand description
A XXH3-64 hasher that keeps its secret on the stack.
The hasher twox_hash ships by default allocates its 192-byte secret on
the heap, so every hash operation costs one allocation. A request that
looks a header up in a map pays that allocation per lookup, which is why
the allocating hasher is the single largest source of allocations on the
request path.
This hasher keeps the same secret and produces the same hash values, but holds the secret in the hasher itself, so hashing allocates nothing.
§Examples
use http_compress::XxHash3_64;
use std::hash::Hasher;
let mut hasher: XxHash3_64 = XxHash3_64::default();
hasher.write(b"connection");
let _: u64 = hasher.finish();Trait Implementations§
Source§impl Clone for XxHash3_64
impl Clone for XxHash3_64
Source§impl Default for XxHash3_64
impl Default for XxHash3_64
Source§impl Hasher for XxHash3_64
impl Hasher for XxHash3_64
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
Auto Trait Implementations§
impl Forget for XxHash3_64
impl Freeze for XxHash3_64
impl Move for XxHash3_64
impl RefUnwindSafe for XxHash3_64
impl Send for XxHash3_64
impl Sync for XxHash3_64
impl Unpin for XxHash3_64
impl UnsafeUnpin for XxHash3_64
impl UnwindSafe for XxHash3_64
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