orx_concurrent_iter/implementations/vec/
into_con_iter.rs

1use super::con_iter::ConIterVec;
2use crate::{
3    implementations::{slice::ConIterSlice, slice_mut::ConIterSliceMut},
4    into_concurrent_iter::IntoConcurrentIter,
5};
6use alloc::vec::Vec;
7
8impl<T> IntoConcurrentIter for Vec<T>
9where
10    T: Send,
11{
12    type Item = T;
13
14    type IntoIter = ConIterVec<T>;
15
16    fn into_con_iter(self) -> Self::IntoIter {
17        Self::IntoIter::new(self)
18    }
19}
20
21impl<'a, T> IntoConcurrentIter for &'a Vec<T>
22where
23    T: Sync,
24{
25    type Item = &'a T;
26
27    type IntoIter = ConIterSlice<'a, T>;
28
29    fn into_con_iter(self) -> Self::IntoIter {
30        Self::IntoIter::new(self.as_slice())
31    }
32}
33
34impl<'a, T> IntoConcurrentIter for &'a mut Vec<T>
35where
36    T: Send,
37{
38    type Item = &'a mut T;
39
40    type IntoIter = ConIterSliceMut<'a, T>;
41
42    fn into_con_iter(self) -> Self::IntoIter {
43        Self::IntoIter::new(self.as_mut_slice())
44    }
45}