Function array_bytes::slice_n_into_unchecked
source · pub fn slice_n_into_unchecked<const N: usize, T, V>(slice: &[T]) -> Vwhere
T: Copy,
V: From<[T; N]>,
Expand description
Just like slice_n_into
but without the checking.
Examples
#[derive(Debug, PartialEq)]
struct LJF([u8; 17]);
impl From<[u8; 17]> for LJF {
fn from(array: [u8; 17]) -> Self {
Self(array)
}
}
assert_eq!(
array_bytes::slice_n_into_unchecked::<17, u8, LJF>(b"Love Jane Forever"),
LJF(*b"Love Jane Forever")
);