Function array_utils::join [−][src]
pub fn join<T, const LEFT_SIZE: usize, const RIGHT_SIZE: usize, const RESULT_SIZE: usize>(
left: [T; LEFT_SIZE],
right: [T; RIGHT_SIZE],
fill: T
) -> [T; RESULT_SIZE] where
T: Copy,
Join two sized arrays together into a new array.
Create a sized array which contain all the elements of left
and right
back to back. If
there are any elements left to fill, they are filled up with the fill
value. Any values of
left
or right
that don’t fit in the given buffer are ignored.
Examples
use array_utils::join; assert_eq!(join([1, 2, 3], [4, 5, 6], 0), [1, 2, 3, 4, 5, 6]); // Leftover elements are filled up assert_eq!(join([1, 2, 3], [4, 5, 6], 0), [1, 2, 3, 4, 5, 6, 0, 0]); // The input arrays are truncated if the resulting array is too short. assert_eq!(join([1, 2, 3], [4, 5, 6], 0), [1, 2, 3, 4, 5]);