Skip to content

Commit

Permalink
re-export rayon traits implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Jan 2, 2025
1 parent 1960dce commit 7874a9c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pretty_assertions = "1.4"
proptest = "1"
proptest-derive = "0.5"
rand = { version = "0.8", default-features = false }
rayon = { version = "1.2", default-features = false }
ruint = { version = "1.12.3", default-features = false, features = ["alloc"] }
ruint-macro = { version = "1", default-features = false }
winnow = { version = "0.6", default-features = false, features = ["alloc"] }
5 changes: 4 additions & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ getrandom = { workspace = true, optional = true }
# rand
rand = { workspace = true, optional = true, features = ["getrandom"] }

# rayon
rayon = { workspace = true, optional = true }

# k256
k256 = { workspace = true, optional = true, features = ["ecdsa"] }

Expand Down Expand Up @@ -132,7 +135,7 @@ map-fxhash = ["map", "dep:rustc-hash"]
getrandom = ["dep:getrandom"]
k256 = ["dep:k256"]
rand = ["dep:rand", "getrandom", "ruint/rand", "rustc-hash?/rand"]
rayon = ["hashbrown?/rayon", "indexmap?/rayon"]
rayon = ["dep:rayon", "hashbrown?/rayon", "indexmap?/rayon"]
rlp = ["dep:alloy-rlp", "ruint/alloy-rlp"]
serde = [
"dep:serde",
Expand Down
19 changes: 19 additions & 0 deletions crates/primitives/src/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,25 @@ cfg_if! {
}
}

#[cfg(feature = "rayon")]
mod rayon {
use super::*;

cfg_if! {
if #[cfg(any(feature = "map-hashbrown", not(feature = "std")))] {
pub use hashbrown::hash_map::rayon::IntoParIter as IntoIter;
pub use hashbrown::hash_map::rayon::ParDrain as Drain;
pub use hashbrown::hash_map::rayon::ParIter as Iter;
pub use hashbrown::hash_map::rayon::ParIterMut as IterMut;
pub use hashbrown::hash_map::rayon::ParKeys as Keys;
pub use hashbrown::hash_map::rayon::ParValues as Values;
pub use hashbrown::hash_map::rayon::ParValuesMut as ValuesMut;
} else {
pub use ::rayon::collections::hash_map::*;
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 7874a9c

Please sign in to comment.