Function fuel_types::bytes::from_loc
source · pub fn from_loc<const ARR: usize, const ADDR: usize, const SIZE: usize>(
_layout: MemLoc<ADDR, SIZE>,
buf: &[u8; ARR]
) -> [u8; SIZE]
Expand description
Get an array from a specific location in a fixed sized slice. This won’t compile if the buffer is not large enough.
let mem = [0u8; 32];
let _: [u8; 2] = from_loc(MemLoc::<1, 2>::new(), &mem);
ⓘ
let mem = [0u8; 32];
let _: [u8; 2] = from_loc(MemLoc::<31, 2>::new(), &mem);
ⓘ
let mem = [0u8; 32];
let _: [u8; 2] = from_loc(MemLoc::<34, 2>::new(), &mem);