orx_parallel/generic_iterator/
collect.rs

1use super::iter::GenericIterator;
2use crate::ParIter;
3use alloc::vec::Vec;
4
5impl<T, S, R, O> GenericIterator<T, S, R, O>
6where
7    T: Send + Sync,
8    S: Iterator<Item = T>,
9    R: rayon::iter::ParallelIterator<Item = T>,
10    O: ParIter<Item = T>,
11{
12    /// Collects the elements of the iterator into a vector.
13    ///
14    /// See [`collect`] for details of the general collect method.
15    ///
16    /// [`collect`]: crate::ParIter::collect
17    pub fn collect_vec(self) -> Vec<T> {
18        match self {
19            GenericIterator::Sequential(x) => x.collect(),
20            GenericIterator::Rayon(x) => x.collect(),
21            GenericIterator::Orx(x) => x.collect(),
22        }
23    }
24}