Skip to content

Commit 5f305da

Browse files
authored
feat: add rapidhash to available hashers (#1051)
1 parent 547695f commit 5f305da

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

crates/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ map = ["alloy-primitives/map"]
6767
map-hashbrown = ["alloy-primitives/map-hashbrown"]
6868
map-indexmap = ["alloy-primitives/map-indexmap"]
6969
map-foldhash = ["alloy-primitives/map-foldhash"]
70+
map-rapidhash = ["alloy-primitives/map-rapidhash"]
7071
map-fxhash = ["alloy-primitives/map-fxhash"]
7172

7273
getrandom = ["alloy-primitives/getrandom"]

crates/primitives/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ std = [
120120
"ruint/std",
121121
"alloy-rlp?/std",
122122
"foldhash?/std",
123+
"rapidhash?/std",
123124
"indexmap?/std",
124125
"k256?/std",
125126
"keccak-asm?/std",
@@ -132,6 +133,7 @@ std = [
132133
]
133134
nightly = [
134135
"foldhash?/nightly",
136+
"rapidhash?/nightly",
135137
"hashbrown?/nightly",
136138
"hex/nightly",
137139
"ruint/nightly",
@@ -149,11 +151,12 @@ map = ["dep:hashbrown"]
149151
map-hashbrown = ["map"]
150152
map-indexmap = ["map", "dep:indexmap"]
151153
map-foldhash = ["map", "dep:foldhash"]
154+
map-rapidhash = ["map", "dep:rapidhash"]
152155
map-fxhash = ["map", "dep:rustc-hash"]
153156

154157
getrandom = ["dep:getrandom"]
155158
k256 = ["dep:k256"]
156-
rand = ["dep:rand", "getrandom", "ruint/rand-09", "rustc-hash?/rand"]
159+
rand = ["dep:rand", "getrandom", "ruint/rand-09", "rapidhash?/rand", "rustc-hash?/rand"]
157160
rayon = ["dep:rayon", "hashbrown?/rayon", "indexmap?/rayon"]
158161
rkyv = ["dep:rkyv", "ruint/rkyv"]
159162
rlp = ["dep:alloy-rlp", "ruint/alloy-rlp"]

crates/primitives/src/map/hasher.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ cfg_if! {
2828
#[doc(no_inline)]
2929
pub use foldhash;
3030

31+
#[cfg(feature = "map-rapidhash")]
32+
#[doc(no_inline)]
33+
pub use rapidhash;
34+
3135
// Default hasher.
3236
cfg_if! {
3337
if #[cfg(feature = "map-foldhash")] {
3438
type DefaultHashBuilderInner = foldhash::fast::RandomState;
39+
} else if #[cfg(feature = "map-rapidhash")] {
40+
type DefaultHashBuilderInner = rapidhash::fast::RandomState;
3541
} else if #[cfg(feature = "map-fxhash")] {
3642
type DefaultHashBuilderInner = FxBuildHasher;
3743
} else if #[cfg(any(feature = "map-hashbrown", not(feature = "std")))] {

0 commit comments

Comments
 (0)