orx_parallel/generic_iterator/
iter.rs1use crate::ParIter;
2
3pub enum GenericIterator<T, S, R, O>
12where
13 T: Send + Sync,
14 S: Iterator<Item = T>,
15 R: rayon::iter::ParallelIterator<Item = T>,
16 O: ParIter<Item = T>,
17{
18 Sequential(S),
20 Rayon(R),
22 Orx(O),
24}
25
26impl<T, S> GenericIterator<T, S, rayon::iter::Empty<T>, crate::iter::ParEmpty<T>>
27where
28 T: Send + Sync,
29 S: Iterator<Item = T>,
30{
31 pub fn sequential(iter: S) -> Self {
33 Self::Sequential(iter)
34 }
35}
36
37impl<T, R> GenericIterator<T, core::iter::Empty<T>, R, crate::iter::ParEmpty<T>>
38where
39 T: Send + Sync,
40 R: rayon::iter::ParallelIterator<Item = T>,
41{
42 pub fn rayon(iter: R) -> Self {
44 Self::Rayon(iter)
45 }
46}
47
48impl<T, O> GenericIterator<T, core::iter::Empty<T>, rayon::iter::Empty<T>, O>
49where
50 T: Send + Sync,
51 O: ParIter<Item = T>,
52{
53 pub fn orx(iter: O) -> Self {
55 Self::Orx(iter)
56 }
57}