Function pop_right

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

Pops one element from the end of the given array a, returning the rest of the array and the popped element in a tuple. No elements are dropped, copied or cloned.

ยงExample

let arr = [1usize, 2, 3, 4, 5];
let (arr, end) = pop_right(arr);

assert_eq!(arr, [1, 2, 3, 4]);
assert_eq!(end, 5);