In my case I am converting from Vec<u32> to Vec<usize>.
Currently doing:
let usize_vec:Vec<usize> = u32_vec.into_iter().map(|x|x as usize).collect();
In my case I am converting from Vec<u32> to Vec<usize>.
Currently doing:
let usize_vec:Vec<usize> = u32_vec.into_iter().map(|x|x as usize).collect();
That's the best way for your particular example, with u32 to usize. If you want to use unsafe features to transmute the contents of the vector instead, you can use std::slice::align_to/std::slice::align_to_mut.