ndarray_parallel/
into_impls.rs1use ndarray::{Array, RcArray, Dimension, ArrayView, ArrayViewMut};
2
3use NdarrayIntoParallelIterator;
4use Parallel;
5
6impl<'a, A, D> NdarrayIntoParallelIterator for &'a Array<A, D>
7 where D: Dimension,
8 A: Sync
9{
10 type Item = &'a A;
11 type Iter = Parallel<ArrayView<'a, A, D>>;
12 fn into_par_iter(self) -> Self::Iter {
13 self.view().into_par_iter()
14 }
15}
16
17impl<'a, A, D> NdarrayIntoParallelIterator for &'a RcArray<A, D>
19 where D: Dimension,
20 A: Sync
21{
22 type Item = &'a A;
23 type Iter = Parallel<ArrayView<'a, A, D>>;
24 fn into_par_iter(self) -> Self::Iter {
25 self.view().into_par_iter()
26 }
27}
28
29impl<'a, A, D> NdarrayIntoParallelIterator for &'a mut Array<A, D>
30 where D: Dimension,
31 A: Sync + Send
32{
33 type Item = &'a mut A;
34 type Iter = Parallel<ArrayViewMut<'a, A, D>>;
35 fn into_par_iter(self) -> Self::Iter {
36 self.view_mut().into_par_iter()
37 }
38}
39
40impl<'a, A, D> NdarrayIntoParallelIterator for &'a mut RcArray<A, D>
42 where D: Dimension,
43 A: Sync + Send + Clone,
44{
45 type Item = &'a mut A;
46 type Iter = Parallel<ArrayViewMut<'a, A, D>>;
47 fn into_par_iter(self) -> Self::Iter {
48 self.view_mut().into_par_iter()
49 }
50}