Function fuel_types::bytes::from_array

source ·
pub fn from_array<const ARR: usize, const SIZE: usize>(
    buf: &[u8; ARR]
) -> [u8; SIZE]
Expand description

Get an array from a fixed sized slice. Won’t compile if the buffer is not large enough.

let mem = [0u8; 2];
let _: [u8; 2] = from_array(&mem);
let mem = [0u8; 1];
let _: [u8; 2] = from_array(&mem);