1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
use crate::MiniVec;

impl<T: Clone> Clone for MiniVec<T> {
    fn clone(&self) -> Self {
        if self.buf.is_null() {
            return MiniVec::new();
        }

        let mut copy = MiniVec::<T>::new();

        copy.reserve(self.len());
        for i in 0..self.len() {
            copy.push(self[i].clone());
        }

        copy
    }
}