(&self)
| 261 | /// ``` |
| 262 | #[inline] |
| 263 | pub fn as_slice(&self) -> &[T] { |
| 264 | // SAFETY |
| 265 | // |
| 266 | // - MutableBuffer is aligned and initialized for len elements of T |
| 267 | // - MutableBuffer corresponds to a single allocation |
| 268 | // - MutableBuffer does not support modification whilst active immutable borrows |
| 269 | unsafe { std::slice::from_raw_parts(self.buffer.as_ptr() as _, self.len()) } |
| 270 | } |
| 271 | |
| 272 | /// View the contents of this buffer as a mutable slice |
| 273 | /// |