Get the written portion of the buffer as a byte slice. The returned slice starts at an aligned address.
(&self)
| 107 | /// |
| 108 | /// The returned slice starts at an aligned address. |
| 109 | pub fn as_slice(&self) -> &[u8] { |
| 110 | // SAFETY: ptr is valid for `len` bytes, and we have shared access. |
| 111 | unsafe { std::slice::from_raw_parts(self.ptr, self.len) } |
| 112 | } |
| 113 | |
| 114 | /// Get the written portion padded up to the next alignment boundary. |
| 115 | /// |
no outgoing calls