Function winter_utils::flatten_vector_elements[][src]

pub fn flatten_vector_elements<T, const N: usize>(source: Vec<[T; N]>) -> Vec<T>
Notable traits for Vec<u8, A>
impl<A> Write for Vec<u8, A> where
    A: Allocator
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);