Debian Codegraph @

.cargo/vendor/indexmap/src/rayon/mod.rs

raw
1 use rayon::prelude::*;
2
3 use alloc::collections::LinkedList;
4
5 use crate::vec::Vec;
6
7 pub mod map;
8 pub mod set;
9
10 // This form of intermediate collection is also how Rayon collects `HashMap`.
11 // Note that the order will also be preserved!
12 fn collect<I: IntoParallelIterator>(iter: I) -> LinkedList<Vec<I::Item>> {
13 iter.into_par_iter()
14 .fold(Vec::new, |mut vec, elem| {
15 vec.push(elem);
16 vec
17 })
18 .map(|vec| {
19 let mut list = LinkedList::new();
20 list.push_back(vec);
21 list
22 })
23 .reduce(LinkedList::new, |mut list1, mut list2| {
24 list1.append(&mut list2);
25 list1
26 })
27 }