debian/missing-sources/hashbrown/src/external_trait_impls/rayon/helpers.rs
raw| 1 | use alloc::collections::LinkedList; |
| 2 | use alloc::vec::Vec; |
| 3 | |
| 4 | use rayon::iter::{IntoParallelIterator, ParallelIterator}; |
| 5 | |
| 6 | /// Helper for collecting parallel iterators to an intermediary |
| 7 | #[allow(clippy::linkedlist)] // yes, we need linked list here for efficient appending! |
| 8 | pub(super) fn collect<I: IntoParallelIterator>(iter: I) -> (LinkedList<Vec<I::Item>>, usize) { |
| 9 | let list = iter.into_par_iter().collect_vec_list(); |
| 10 | |
| 11 | let len = list.iter().map(Vec::len).sum(); |
| 12 | (list, len) |
| 13 | } |