Function array_utils::array_resize [−][src]
pub fn array_resize<T, const INPUT_SIZE: usize, const OUTPUT_SIZE: usize>(
array: [T; INPUT_SIZE],
fill: T
) -> [T; OUTPUT_SIZE] where
T: Copy,
Resize a sized array to a different size.
Copy over the element from array
into the resulting array. Truncating the original array or
filling unfilled elements the fill
value.
Examples
use array_utils::array_resize; // Truncating unnecessary values assert_eq!(array_resize([1, 2, 3], 0), [1, 2]); // Inserting the `fill` value assert_eq!(array_resize([1, 2, 3], 0), [1, 2, 3, 0]);