I would like to write a function that consumes a Vec and returns it in some form with a bit from the beginning cut (or rather hidden). Basically like this:
fn foo(v: Vec<u8>) -> &[u8] {
v[16..]
}
Of course this doesn't work because after the function call the Vec is consumed and the slice has no owner.
I would like to avoid shifting the Vec elements to the left because the Vec can potentially be a few hundred MB in size and I want to cut only a few bytes. I would like those "hidden" bytes to be freed when the rest of the Vec is freed.
Is this possible?