fn test<T>(arr: &mut [T]) {
let vector=vec![] //what can I do here so that I have vector as vec with same size as arr and of type T.
}
fn main() {
let xs = vec![1, 2, 3, 4, 5, 6];
test(&mut xs);
}
Is there any solution if I enforce T to have Default trait? I should be able to randomly access the created vector, not push serially.