Function winter_utils::flatten_slice_elements[][src]

pub fn flatten_slice_elements<T, const N: usize>(source: &[[T; N]]) -> &[T]
Notable traits for &'_ [u8]
impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
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);