[−][src]Struct ahash::LocationBasedState
Provides a BuildHasher
is typically used (e.g. by HashMap
) to create
AHasher
s for each key such that they are hashed independently of one
another, since AHasher
s 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 them.
For each instance of LocationBasedState
, the AHasher
s created by
build_hasher
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]
pub fn new() -> LocationBasedState
[src]
Trait Implementations
impl Default for LocationBasedState
[src]
fn default() -> LocationBasedState
[src]
impl BuildHasher for LocationBasedState
[src]
type Hasher = AHasher
Type of the hasher that will be created.
fn build_hasher(&self) -> AHasher
[src]
Auto Trait Implementations
impl Send for LocationBasedState
impl Sync for LocationBasedState
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,