So obviously I can't borrow vv mutably if later I use it immutably. What would be the most idiomatic way around it? I can't take ownership of vectors and I would like to avoid cloning.
Thanks
In this case you can use split_first_mut to create the non-overlapping references you want. You are in luck because the borrows you want are non-overlapping.
Thanks. It kinda works, but is a bit ugly. Sometimes second index is lower, sometimes higher. Also, I have to add some logic to prevent index be the same. But still, I prefer this to unsafe.