Function konst::slice::as_chunks

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

Const equivalent of <[T]>::as_chunks

§Panics

Panics if N == 0.

§Example

use konst::slice;

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

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