pub fn resize_preserving_order<T>(vec: &[T], new_len: usize) -> Vec<T>where T: Clone,
Resize the vec while preserving the order