pub struct NoopU64Hasher(/* private fields */);
Expand description
A no-op hasher that writes u64
values directly to the internal state.
In some cases, pre-hashed values (u64
) may be used as the key to a hash table or similar data structure. In those
cases, re-hashing the key each time is unnecessary and potentially even undesirable.
NoopU64Hasher
is a hash implementation that simply forwards u64
values to the internal state and uses that as
the final hashed value. It can used to hash a u64
value directly, or to hash a value that wraps a u64
value,
such as a newtype (e.g., struct HashKey(u64)
).
§Behavior
NoopU64Hasher
stores a single u64
value internally. The last value written via write_u64
is the final hash
value. Writing any other value type to the hasher will panic.
Trait Implementations§
Source§impl Default for NoopU64Hasher
impl Default for NoopU64Hasher
Source§fn default() -> NoopU64Hasher
fn default() -> NoopU64Hasher
Returns the “default value” for a type. Read more
Source§impl Hasher for NoopU64Hasher
impl Hasher for NoopU64Hasher
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 Freeze for NoopU64Hasher
impl RefUnwindSafe for NoopU64Hasher
impl Send for NoopU64Hasher
impl Sync for NoopU64Hasher
impl Unpin for NoopU64Hasher
impl UnwindSafe for NoopU64Hasher
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Track for T
impl<T> Track for T
§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Instruments this type by attaching the given allocation group token, returning a
Tracked
wrapper. Read more§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Instruments this type by attaching the current allocation group, returning a
Tracked
wrapper. Read more