1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use std::collections::VecDeque;
use iter::plumbing::*;
use iter::*;
use slice;
use vec;
#[derive(Debug, Clone)]
pub struct IntoIter<T: Send> {
inner: vec::IntoIter<T>,
}
into_par_vec! {
VecDeque<T> => IntoIter<T>,
impl<T: Send>
}
delegate_indexed_iterator! {
IntoIter<T> => T,
impl<T: Send>
}
#[derive(Debug)]
pub struct Iter<'a, T: Sync + 'a> {
inner: Chain<slice::Iter<'a, T>, slice::Iter<'a, T>>,
}
impl<'a, T: Sync> Clone for Iter<'a, T> {
fn clone(&self) -> Self {
Iter {
inner: self.inner.clone(),
}
}
}
impl<'a, T: Sync> IntoParallelIterator for &'a VecDeque<T> {
type Item = &'a T;
type Iter = Iter<'a, T>;
fn into_par_iter(self) -> Self::Iter {
let (a, b) = self.as_slices();
Iter {
inner: a.into_par_iter().chain(b),
}
}
}
delegate_indexed_iterator! {
Iter<'a, T> => &'a T,
impl<'a, T: Sync + 'a>
}
#[derive(Debug)]
pub struct IterMut<'a, T: Send + 'a> {
inner: Chain<slice::IterMut<'a, T>, slice::IterMut<'a, T>>,
}
impl<'a, T: Send> IntoParallelIterator for &'a mut VecDeque<T> {
type Item = &'a mut T;
type Iter = IterMut<'a, T>;
fn into_par_iter(self) -> Self::Iter {
let (a, b) = self.as_mut_slices();
IterMut {
inner: a.into_par_iter().chain(b),
}
}
}
delegate_indexed_iterator! {
IterMut<'a, T> => &'a mut T,
impl<'a, T: Send + 'a>
}