pub fn flatten_vector_elements<T, const N: usize>(source: Vec<[T; N]>) -> Vec<T>
Expand description
Transmutes a vector of n
arrays each of length N
, into a vector of N
* n
elements.
This function just re-interprets the underlying memory and is thus zero-copy.
ยงExample
let a = vec![[1, 2, 3, 4], [5, 6, 7, 8]];
let b = flatten_vector_elements(a);
assert_eq!(vec![1, 2, 3, 4, 5, 6, 7, 8], b);