Skip to content

Commit

Permalink
chore(deps): bump hashbrown to 0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Oct 4, 2024
1 parent 0cd3a72 commit 3b5f2f5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tiny-keccak = { version = "2.0", default-features = false }
sha3 = { version = "0.10.8", default-features = false }

# maps
hashbrown = { version = "0.14", default-features = false }
hashbrown = { version = "0.15", default-features = false }
indexmap = { version = "2.5", default-features = false }
rustc-hash = { version = "2.0", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ k256 = { workspace = true, optional = true, features = ["ecdsa"] }

# map
hashbrown = { workspace = true, optional = true, features = [
"ahash",
"default-hasher",
"inline-more",
] }
indexmap = { workspace = true, optional = true }
Expand Down
12 changes: 11 additions & 1 deletion crates/primitives/src/map/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,22 @@ impl<const N: usize> BuildHasher for FbBuildHasher<N> {
/// Works best with `fxhash`, enabled by default with the "map-fxhash" feature.
///
/// **NOTE:** this hasher accepts only `N`-length byte arrays! It is invalid to hash anything else.
#[derive(Clone, Default)]
#[derive(Clone)]
pub struct FbHasher<const N: usize> {
inner: DefaultHasher,
_marker: core::marker::PhantomData<[(); N]>,
}

impl<const N: usize> Default for FbHasher<N> {
#[inline]
fn default() -> Self {
Self {
inner: DefaultHashBuilder::default().build_hasher(),
_marker: core::marker::PhantomData,
}
}
}

impl<const N: usize> fmt::Debug for FbHasher<N> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("FbHasher").finish_non_exhaustive()
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ cfg_if! {
if #[cfg(feature = "map-fxhash")] {
type DefaultHashBuilderInner = FxBuildHasher;
} else if #[cfg(any(feature = "map-hashbrown", not(feature = "std")))] {
type DefaultHashBuilderInner = hashbrown::hash_map::DefaultHashBuilder;
type DefaultHashBuilderInner = hashbrown::DefaultHashBuilder;
} else {
type DefaultHashBuilderInner = std::collections::hash_map::RandomState;
}
Expand Down

0 comments on commit 3b5f2f5

Please sign in to comment.