Skip to main content

KeyHasher

Struct KeyHasher 

Source
pub struct KeyHasher(/* private fields */);
๐Ÿ‘ŽDeprecated since 0.24.4:

Use metrics-util::common::KeyHasher instead.

Expand description

Key-specific hashing algorithm.

Deprecated in favor of a no-hash based implementation in metrics-util::common::KeyHasher.

This hasher operates in two modes. When only write_u64 is called โ€” the path taken by Keyโ€™s Hash impl, which writes the pre-computed key hash via write_u64(self.hash) โ€” finish returns that value verbatim, matching Hashable::hashable(&key) and the no-op metrics_util::common::KeyHasher. When arbitrary bytes are written via write (or any of the typed write_* methods that route through write), this hasher falls back to hashing with rapidhash - https://github.com/hoxxep/rapidhash - preserving the previous byte-hashing behavior for callers like metrics_util::DefaultHashable<H> in metrics-util 0.19.x.

Trait Implementationsยง

Sourceยง

impl Debug for KeyHasher

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for KeyHasher

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl Hasher for KeyHasher

Sourceยง

fn finish(&self) -> u64

Returns the hash value for the values written so far. Read more
Sourceยง

fn write(&mut self, bytes: &[u8])

Writes some data into this Hasher. Read more
Sourceยง

fn write_u64(&mut self, i: u64)

Writes a single u64 into this hasher.
1.3.0 ยท Sourceยง

fn write_u8(&mut self, i: u8)

Writes a single u8 into this hasher.
1.3.0 ยท Sourceยง

fn write_u16(&mut self, i: u16)

Writes a single u16 into this hasher.
1.3.0 ยท Sourceยง

fn write_u32(&mut self, i: u32)

Writes a single u32 into this hasher.
1.26.0 ยท Sourceยง

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)

Writes a single usize into this hasher.
1.3.0 ยท Sourceยง

fn write_i8(&mut self, i: i8)

Writes a single i8 into this hasher.
1.3.0 ยท Sourceยง

fn write_i16(&mut self, i: i16)

Writes a single i16 into this hasher.
1.3.0 ยท Sourceยง

fn write_i32(&mut self, i: i32)

Writes a single i32 into this hasher.
1.3.0 ยท Sourceยง

fn write_i64(&mut self, i: i64)

Writes a single i64 into this hasher.
1.26.0 ยท Sourceยง

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)

Writes a single isize into this hasher.
Sourceยง

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
Sourceยง

fn write_str(&mut self, s: &str)

๐Ÿ”ฌThis is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a single str into this hasher. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.