pub struct UintIdentity { /* private fields */ }Expand description
A “do-nothing” hasher for uint.
Most users typically store keys that are already hashed (shortened by the Translator). Re-hashing them with SipHash (by std::collections::HashMap) would waste CPU, so we give std::collections::HashMap this identity hasher instead:
- Hasher::write_u8, Hasher::write_u16, Hasher::write_u32, Hasher::write_u64 copies the input into an internal field;
- Hasher::finish returns that value unchanged.
§Warning
This hasher is not suitable for general use. If the hasher is called over some type that is not u8, u16, u32 or u64, it will panic.
Trait Implementations§
Source§impl Clone for UintIdentity
impl Clone for UintIdentity
Source§fn clone(&self) -> UintIdentity
fn clone(&self) -> UintIdentity
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for UintIdentity
impl Default for UintIdentity
Source§fn default() -> UintIdentity
fn default() -> UintIdentity
Returns the “default value” for a type. Read more
Source§impl Hasher for UintIdentity
impl Hasher for UintIdentity
1.26.0§fn write_u128(&mut self, i: u128)
fn write_u128(&mut self, i: u128)
Writes a single
u128 into this hasher.1.3.0§fn write_usize(&mut self, i: usize)
fn write_usize(&mut self, i: usize)
Writes a single
usize into this hasher.1.26.0§fn write_i128(&mut self, i: i128)
fn write_i128(&mut self, i: i128)
Writes a single
i128 into this hasher.1.3.0§fn write_isize(&mut self, i: isize)
fn write_isize(&mut self, i: isize)
Writes a single
isize into this hasher.§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 UintIdentity
impl RefUnwindSafe for UintIdentity
impl Send for UintIdentity
impl Sync for UintIdentity
impl Unpin for UintIdentity
impl UnwindSafe for UintIdentity
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more