konst::slice

Function as_rchunks

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

Const equivalent of <[T]>::as_rchunks

The equivalent std function is unstable as of Rust 1.83.0.

§Panics

Panics if N == 0.

§Example

use konst::slice;

let (rem, arrs) = slice::as_rchunks::<_, 2>(&[2u32, 3, 5, 8, 13, 21, 34]);

assert_eq!(rem, &[2][..]);
assert_eq!(arrs, &[[3, 5], [8, 13], [21, 34]][..]);