Pairwise-swap the values pointed to by `lhs` and `rhs`. # Safety `lhs` and `rhs` must have equal length (enforced by debug assert). Each `(lhs[i], rhs[i])` pair must point to valid, properly-aligned `T` locations and must not alias another live reference. `lhs` and `rhs` themselves must point to disjoint memory.
(lhs: &mut [*mut T], rhs: &mut [*mut T])
| 25 | /// `T` locations and must not alias another live reference. |
| 26 | /// * `lhs` and `rhs` themselves must point to disjoint memory. |
| 27 | pub unsafe fn swap_vec_ptr<T>(lhs: &mut [*mut T], rhs: &mut [*mut T]) |
| 28 | where |
| 29 | T: Copy, |
| 30 | { |
| 31 | assert_eq!(lhs.len(), rhs.len(), "Should use same length vectors"); |
| 32 | for (&mut l, &mut r) in lhs.iter_mut().zip(rhs.iter_mut()) { |
| 33 | std::ptr::swap(l, r); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /// Dereference every pointer in `pv` and collect the values into a `Vec`. |
| 38 | /// |