Function fuel_types::bytes::from_array_ref
source · pub fn from_array_ref<const ARR: usize, const SIZE: usize>(
buf: &[u8; ARR]
) -> &[u8; SIZE]
Expand description
Get a fixed sized slice from a fixed sized slice. Won’t compile if the buffer is not large enough.
let mem = [0u8; 2];
let _: &[u8; 2] = from_array_ref(&mem);
ⓘ
let mem = [0u8; 1];
let _: &[u8; 2] = from_array_ref(&mem);