1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::{
    iter::{constructors::into_con_iter::IntoConcurrentIter, implementors::array::ConIterOfArray},
    ConIterOfSlice, ConcurrentIterable,
};

impl<const N: usize, T: Send + Sync> ConcurrentIterable for [T; N] {
    type Item<'i> = &'i T where Self: 'i;

    type ConIter<'i> = ConIterOfSlice<'i, T> where Self: 'i;

    fn con_iter(&self) -> Self::ConIter<'_> {
        Self::ConIter::new(self.as_slice())
    }
}

impl<const N: usize, T: Send + Sync> IntoConcurrentIter for [T; N] {
    type Item = T;

    type ConIter = ConIterOfArray<N, T>;

    fn into_con_iter(self) -> Self::ConIter {
        Self::ConIter::new(self)
    }
}