Function split_end

Source
pub fn split_end<const N: usize, const M: usize, T>(
    a: [T; N],
) -> ([T; { _ }], [T; M])
where [(); { _ }]:,
Expand description

Identical to split, but splits starting from the end of the array, to hopefully help with compiler proofs (in cases like pop_right).

ยงExample

let arr = [1usize, 2, 3, 4, 5];
let (left, right) = split_end::<5, 3, usize>(arr);

assert_eq!(left, [1, 2]);
assert_eq!(right, [3, 4, 5]);