deterministic_default_hasher 0.14.2

A deterministic initialisation of the stdlib default hasher
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::hash::{BuildHasher, DefaultHasher};

/// A [`BuildHasher`] that builds the standard libraries default hasher with a deterministic seed.
///
/// See also [`DefaultHasher::new`].
#[derive(Default)]
pub struct DeterministicDefaultHasher;

impl BuildHasher for DeterministicDefaultHasher {
    type Hasher = DefaultHasher;

    fn build_hasher(&self) -> Self::Hasher {
        DefaultHasher::new()
    }
}