1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use std::hash::SipHasher;
use std::hash::BuildHasher;

/// A hasher builder that creates `SipHasher` with default keys.
pub struct DeterministicState;

impl DeterministicState {
    /// Creates a new `DeterministicState` that builds `SipHasher` with default keys.
    pub fn new() -> DeterministicState {
        DeterministicState
    }
}

impl BuildHasher for DeterministicState {
    type Hasher = SipHasher;

    fn build_hasher(&self) -> SipHasher {
        SipHasher::new()
    }
}