[][src]Function array_tools::join

pub fn join<T, A: FixedSizeArray<T>, LEFT: FixedSizeArray<T>, RIGHT: FixedSizeArray<T>>(
    left: LEFT,
    right: RIGHT
) -> A

Joins two arrays.

Creates a new array instance of length equal to sum of input arrays' lengths and containing elements of right array appended to elements of the left.

Element types of first, second and output arrays must match. Sum of input arrays' lengths must match exactly length of output array.

Does not perform any cloning operations, only moves values.

Panics

  • Panics if output array length is not equal to sum of input arrays' lengths.

Note

Though currently it panics if output array has incompatible length, this behavior will be changed to perform this check at compile time, when this will become possible.

Examples

use array_tools;

let left = [1u64, 2];
let right = [3u64, 4, 5, 6, 7, 8];
let joined: [u64; 8] = array_tools::join(left, right);
assert_eq!(joined, [1u64, 2, 3, 4, 5, 6, 7, 8]);