Type Alias StableHasher

pub type StableHasher = StableHasher<SipHasher128>;
Expand description

Stable 128-bits Sip Hasher

StableHasher version of [SipHasher128].

Aliased Type§

struct StableHasher { /* private fields */ }

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 120 bytes

Implementations

§

impl<H> StableHasher<H>
where H: ExtendedHasher + Default,

pub fn new() -> StableHasher<H>

Creates a new [StableHasher].

To be used with the Hasher implementation and [StableHasher::finish].

§

impl<H> StableHasher<H>
where H: ExtendedHasher,

pub fn with_hasher(state: H) -> StableHasher<H>

Creates a new [StableHasher] from an already created [ExtendedHasher].

Useful when wanting to initialize a hasher with different parameters/keys.

Important: Any use of the hasher before being given to a [StableHasher] is not covered by this crate guarentees and will make the resulting hash NOT platform independent.

pub fn finish<W>(self) -> W
where W: FromStableHash<Hash = <H as ExtendedHasher>::Hash>,

Returns the typed-hash value for the values written.

The resulting typed-hash value is constructed from an [FromStableHash] implemenation.

To be used in-place of Hasher::finish.

Trait Implementations

§

impl<H> Clone for StableHasher<H>
where H: Clone + ExtendedHasher,

§

fn clone(&self) -> StableHasher<H>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<H> Debug for StableHasher<H>
where H: ExtendedHasher + Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<H> Default for StableHasher<H>
where H: ExtendedHasher + Default,

§

fn default() -> StableHasher<H>

Creates a new [StableHasher].

To be used with the Hasher implementation and [StableHasher::finish].

§

impl<H> Hasher for StableHasher<H>
where H: ExtendedHasher,

§

fn finish(&self) -> u64

Returns a combined hash.

For greater precision use instead [StableHasher::finish].

§

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

Writes some data into this Hasher. Read more
§

fn write_u8(&mut self, i: u8)

Writes a single u8 into this hasher.
§

fn write_u16(&mut self, i: u16)

Writes a single u16 into this hasher.
§

fn write_u32(&mut self, i: u32)

Writes a single u32 into this hasher.
§

fn write_u64(&mut self, i: u64)

Writes a single u64 into this hasher.
§

fn write_u128(&mut self, i: u128)

Writes a single u128 into this hasher.
§

fn write_usize(&mut self, i: usize)

Writes a single usize into this hasher.
§

fn write_i8(&mut self, i: i8)

Writes a single i8 into this hasher.
§

fn write_i16(&mut self, i: i16)

Writes a single i16 into this hasher.
§

fn write_i32(&mut self, i: i32)

Writes a single i32 into this hasher.
§

fn write_i64(&mut self, i: i64)

Writes a single i64 into this hasher.
§

fn write_i128(&mut self, i: i128)

Writes a single i128 into this hasher.
§

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