pub fn split_pair<T>(
slots: &mut [T],
dst: usize,
src: usize,
) -> Option<(&T, &mut T)>Expand description
Borrows two distinct slots of one bank at once: the source shared, the destination mutable.
This is the whole reason a slot is its own allocation. A
device-to-device copy needs both borrows live simultaneously, which
two sub-views of one buffer cannot give; split_at_mut over
separate allocations can. Splitting at the HIGHER of the two indices
is what puts exactly one of the pair in each half.
Lives outside the cuda feature gate so the index arithmetic –
the one part of the copy path that a compiler cannot check and a
GPU-less host can – is exercised by the ordinary test run. Returns
None when the two are equal (a self-copy, which every caller
should have short-circuited) or when either is out of range.