pub fn flatten_slice_elements<T, const N: usize>(source: &[[T; N]]) -> &[T]
Expand description
Transmutes a slice of n
arrays each of length N
, into a slice 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_slice_elements(&a);
assert_eq!(&[1, 2, 3, 4, 5, 6, 7, 8], b);