Skip to main content

orx_concurrent_iter/implementations/range/
con_iterable.rs

1use super::con_iter::ConIterRange;
2use crate::{
3    concurrent_iterable::ConcurrentIterable,
4    implementations::range::into_con_iter::range_inclusive_to_range,
5};
6use core::ops::{Range, RangeInclusive};
7
8impl<T> ConcurrentIterable for Range<T>
9where
10    T: Send + From<usize> + Into<usize>,
11    Range<T>: Default + Clone + ExactSizeIterator<Item = T>,
12{
13    type Item = T;
14
15    type Iter = ConIterRange<T>;
16
17    fn con_iter(&self) -> Self::Iter {
18        Self::Iter::new(self.clone())
19    }
20}
21
22impl<T> ConcurrentIterable for RangeInclusive<T>
23where
24    T: Send + From<usize> + Into<usize> + Clone,
25    Range<T>: Default + Clone + ExactSizeIterator<Item = T>,
26{
27    type Item = T;
28
29    type Iter = ConIterRange<T>;
30
31    fn con_iter(&self) -> Self::Iter {
32        range_inclusive_to_range(self.clone()).con_iter()
33    }
34}