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
use crate::{
    iter::{
        constructors::into_exact_con_iter::IntoExactSizeConcurrentIter,
        implementors::vec::ConIterOfVec,
    },
    ConIterOfSlice, ConcurrentIterable, IntoConcurrentIter,
};

impl<T: Send + Sync + Default> ConcurrentIterable for Vec<T> {
    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<T: Send + Sync + Default> IntoConcurrentIter for Vec<T> {
    type Item = T;

    type ConIter = ConIterOfVec<T>;

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

impl<T: Send + Sync + Default> IntoExactSizeConcurrentIter for Vec<T> {
    type Item = T;

    type ExactConIter = ConIterOfVec<T>;

    fn into_exact_con_iter(self) -> Self::ExactConIter {
        Self::ExactConIter::new(self)
    }

    fn exact_len(&self) -> usize {
        self.len()
    }
}