From 8deba44f3d7c44751046db7d8a9e259320760d23 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 15 Feb 2022 18:26:59 +0300 Subject: [PATCH] Add a way to create `FxHasher` with a given seed Add `FxHasher::with_seed`. --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 997be1e..8cd8dcf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 {