orx_concurrent_vec/concurrent_slice/to_vec.rs
1use super::ConcurrentSlice;
2use crate::elem::ConcurrentElement;
3use alloc::vec::Vec;
4use orx_fixed_vec::IntoConcurrentPinnedVec;
5
6impl<T, P> ConcurrentSlice<'_, T, P>
7where
8 P: IntoConcurrentPinnedVec<ConcurrentElement<T>>,
9{
10 /// Clones the values of elements of the slice into a regular vector.
11 pub fn clone_to_vec(&self) -> Vec<T>
12 where
13 T: Clone,
14 {
15 let iter = self.iter_cloned();
16 let mut vec = Vec::with_capacity(self.len());
17 for x in iter {
18 vec.push(x);
19 }
20 vec
21 }
22}