Returns the offset, in bytes, of `Self::ptr` to `Self::data` self.ptr and self.data can be different after slicing or advancing the buffer.
(&self)
| 107 | /// |
| 108 | /// self.ptr and self.data can be different after slicing or advancing the buffer. |
| 109 | pub fn ptr_offset(&self) -> usize { |
| 110 | // Safety: `ptr` is always in bounds of `data`. |
| 111 | unsafe { self.ptr.offset_from(self.data.ptr().as_ptr()) as usize } |
| 112 | } |
| 113 | |
| 114 | /// Returns the pointer to the start of the buffer without the offset. |
| 115 | pub fn data_ptr(&self) -> NonNull<u8> { |
no test coverage detected