Skip to content

Commit

Permalink
Add a way to create FxHasher with a given seed
Browse files Browse the repository at this point in the history
Add `FxHasher::with_seed`.
  • Loading branch information
WaffleLapkin committed Jan 14, 2024
1 parent 84304c1 commit 8deba44
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ const K: usize = 0x9e3779b9;
#[cfg(target_pointer_width = "64")]
const K: usize = 0x517cc1b727220a95;

impl FxHasher {
/// Creates `fx` hasher with a given seed.
pub fn with_seed(seed: usize) -> FxHasher {
FxHasher { hash: seed }
}
}

impl Default for FxHasher {
#[inline]
fn default() -> FxHasher {
Expand Down

0 comments on commit 8deba44

Please sign in to comment.