Function slice
Source pub fn slice<const T: usize>(data: &[u8], offset: usize) -> &[u8; T]
Expand description
Returns a slice of the given data with the specified length
§Arguments
data - The data to slice
offset - The offset to start the slice
§Returns
A slice of the given data with the specified length
§Example
let data = [1, 2, 3, 4, 5];
let sliced = slice::<3>(&data, 1);
assert_eq!(sliced, [2, 3, 4]);