Returns the aligned buffer as a slice.
(&self)
| 52 | |
| 53 | /// Returns the aligned buffer as a slice. |
| 54 | pub fn as_bytes(&self) -> &[u8] { |
| 55 | // SAFETY: `new` allocates `size` bytes via alloc_zeroed (so they |
| 56 | // are initialized) and AlignedOperation owns the buffer |
| 57 | // exclusively. |
| 58 | unsafe { std::slice::from_raw_parts(self.aligned_ptr, self.size) } |
| 59 | } |
| 60 | |
| 61 | /// Returns the aligned buffer as a mutable slice. |
| 62 | pub fn as_bytes_mut(&mut self) -> &mut [u8] { |
no outgoing calls