Returns two mutable slices representing the two requested blocks. The two returned slices can be longer than the blocks. Each block is located at the front of the respective slice.
(&mut self, block0: usize, block1: usize)
| 234 | /// The two returned slices can be longer than the blocks. Each block is located at the front |
| 235 | /// of the respective slice. |
| 236 | fn mut_slices(&mut self, block0: usize, block1: usize) -> (&mut [T], &mut [T]) { |
| 237 | if block0 < block1 { |
| 238 | let (s0, s1) = self.data.split_at_mut(block1); |
| 239 | (&mut s0[block0..], s1) |
| 240 | } else { |
| 241 | let (s1, s0) = self.data.split_at_mut(block0); |
| 242 | (s0, &mut s1[block1..]) |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | /// Reallocate a block to a different size class. |
| 247 | /// |