I have something like this:
let test_data: [u8; 6] = [0, 1, 2, 3, 4, 5];
How can I get a &[u8; 3]
pointing to the first three elements?
I know I can do test_data[0 .. 3]
, but that returns a slice [u8]
. I'd also rather not convert the slice to an array if possible because I'm doing this with a ton of arrays and it needs to be as efficient as possible.
I'm doing this so that I can parse information from a byte array, so if there's an easier way to do that than splitting the array up, I'm also interested in that.