Skip to content

Commit

Permalink
Use rayon-1.9.0's collect_vec_list
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Nov 13, 2024
1 parent bf0362b commit 7d8cef8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ arbitrary = { version = "1.0", optional = true, default-features = false }
quickcheck = { version = "1.0", optional = true, default-features = false }
serde = { version = "1.0", optional = true, default-features = false }
borsh = { version = "1.2", optional = true, default-features = false }
rayon = { version = "1.5.3", optional = true }
rayon = { version = "1.9", optional = true }

# Internal feature, only used when building as part of rustc,
# not part of the stable interface of this crate.
Expand Down
15 changes: 1 addition & 14 deletions src/rayon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,5 @@ pub mod set;
// This form of intermediate collection is also how Rayon collects `HashMap`.
// Note that the order will also be preserved!
fn collect<I: IntoParallelIterator>(iter: I) -> LinkedList<Vec<I::Item>> {
iter.into_par_iter()
.fold(Vec::new, |mut vec, elem| {
vec.push(elem);
vec
})
.map(|vec| {
let mut list = LinkedList::new();
list.push_back(vec);
list
})
.reduce(LinkedList::new, |mut list1, mut list2| {
list1.append(&mut list2);
list1
})
iter.into_par_iter().collect_vec_list()
}

0 comments on commit 7d8cef8

Please sign in to comment.