1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Utility functions for the crate.
/// Splits the slice into a slice of `N`-element arrays,
/// starting at the beginning of the slice,
/// and a remainder slice with length strictly less than `N`.
///
/// This a port of the unstable `slice_as_chunks` feature.
///
/// # Safety
/// N must be non-zero.
///
/// # Examples
///
/// ```
/// use base16384::utils::slice_as_chunks;
///
/// let slice = ['l', 'o', 'r', 'e', 'm'];
/// let (chunks, remainder) = unsafe { slice_as_chunks(&slice) };
/// assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]);
/// assert_eq!(remainder, &['m']);
/// ```
pub unsafe
/// Splits the slice into a slice of `N`-element arrays,
/// starting at the beginning of the slice.
///
/// This a port of the unstable `slice_as_chunks` feature.
///
/// # Safety
/// N must be non-zero and the length of the slice must be a multiple of `N`.
///
/// # Examples
/// ```
/// use base16384::utils::slice_as_chunks_exact;
///
/// let slice = ['l', 'o', 'r', 'e'];
/// let chunks = unsafe { slice_as_chunks_exact(&slice) };
/// assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]);
/// ```
pub unsafe