[][src]Struct ahash::LocationBasedState

pub struct LocationBasedState {}

Provides a BuildHasher is typically used (e.g. by HashMap) to create AHashers for each key such that they are hashed independently of one another, since AHashers contain state.

LocationBasedState uses it's in-memory location to see the AHasher. This is more predictable than true random values, but does not require generating randomness.

For each instance of LocationBasedState, the AHashers created by BuildHasher should be identical. That is, if the same stream of bytes is fed into each hasher, the same output will also be generated.

Examples

use ahash::LocationBasedState;
use std::hash::{BuildHasher, Hasher};

let s = LocationBasedState::new();
let mut hasher_1 = s.build_hasher();
let mut hasher_2 = s.build_hasher();

hasher_1.write_u32(8128);
hasher_2.write_u32(8128);

assert_eq!(hasher_1.finish(), hasher_2.finish());

Methods

impl LocationBasedState[src]

Trait Implementations

impl Default for LocationBasedState[src]

impl BuildHasher for LocationBasedState[src]

type Hasher = AHasher

Type of the hasher that will be created.

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.