Function konst::slice::rchunks

source ·
pub const fn rchunks<T>(slice: &[T], chunk_size: usize) -> RChunks<'_, T>
Expand description

Const equivalent of <[T]>::rchunks

§Panics

Panics if chunk_size == 0.

§Example

use konst::iter::collect_const;
use konst::slice;

const CHUNKS: [&[u8]; 3] = collect_const!{&[u8] =>
    slice::rchunks(&[3, 5, 8, 13, 21, 34, 55, 89], 3)
};

let expected: &[&[u8]] = &[&[34, 55, 89], &[8, 13, 21], &[3, 5]];

assert_eq!(CHUNKS, expected)