Function as_rchunks

Source
pub const fn as_rchunks<T, const N: usize>(vals: &[T]) -> (&[T], &[[T; N]])
Expand description

Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N.

§Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

§Examples

let slice = ['l', 'o', 'r', 'e', 'm'];
let (remainder, chunks) = array_util::as_rchunks(&slice);
assert_eq!(remainder, &['l']);
assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]);