orx_concurrent_vec/common_traits/
clone.rs

1use crate::ConcurrentVec;
2
3impl<T> Clone for ConcurrentVec<T>
4where
5    T: Clone,
6{
7    /// A thread-safe method to clone the concurrent vec.
8    ///
9    /// # Example
10    ///
11    /// ```
12    /// use orx_concurrent_vec::*;
13    ///
14    /// let vec: ConcurrentVec<_> = (0..4).into_iter().collect();
15    /// let clone = vec.clone();
16    ///
17    /// assert_eq!(&clone, &[0, 1, 2, 3]);
18    /// ```
19    fn clone(&self) -> Self {
20        self.iter_cloned().collect()
21    }
22}