Function array_append::split
source · [−]Expand description
Splits the given array a
at the given point M
. Returns a tuple
containing two arrays where the first element is an array containing all
elements from a[..M]
and the second element is an array containing all
elements from a[M..]
. No elements are dropped, copied or cloned.
Example
let arr = [1usize, 2, 3, 4, 5];
// Currently, the turbofish syntax is required. rustc still cannot infer
// them even if you fully annotate these variables' types.
let (left, right) = split::<5, 3, usize>(arr);
assert_eq!(left, [1, 2, 3]);
assert_eq!(right, [4, 5]);