(&mut self)
| 285 | /// ``` |
| 286 | #[inline] |
| 287 | pub fn as_slice_mut(&mut self) -> &mut [T] { |
| 288 | // SAFETY |
| 289 | // |
| 290 | // - MutableBuffer is aligned and initialized for len elements of T |
| 291 | // - MutableBuffer corresponds to a single allocation |
| 292 | // - MutableBuffer does not support modification whilst active immutable borrows |
| 293 | unsafe { std::slice::from_raw_parts_mut(self.buffer.as_mut_ptr() as _, self.len()) } |
| 294 | } |
| 295 | |
| 296 | /// Shorten this BufferBuilder to `len` items |
| 297 | /// |