array2d
array2d copied to clipboard
Is it possible to swap two values at known indices?
If I was using a vec of vecs, this would be reasonably easy:
if they're in the same inner vec then just
arr.swap(index1, index2)
and if they're in different vecs then i can get a mutable reference to each and just
std::mem::swap(&mut value1, &mut value2)
I can't figure out a way to do this with the API you make available, even with std::ptr::swap