1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::{Growth, SplitVec};

impl<T, G> Clone for SplitVec<T, G>
where
    T: Clone,
    G: Growth,
{
    fn clone(&self) -> Self {
        let fragments: Vec<_> = self
            .fragments
            .iter()
            .map(|fragment| {
                let mut vec = Vec::with_capacity(fragment.capacity());
                vec.extend_from_slice(fragment);
                vec.into()
            })
            .collect();
        Self {
            fragments,
            len: self.len,
            growth: self.growth.clone(),
        }
    }
}