Skip to content

Commit

Permalink
For review
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Jun 18, 2024
1 parent fe54f67 commit 4959548
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions arrow-buffer/src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,9 @@ impl Buffer {
/// 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.
///
/// # Safety
///
/// This function is unsafe as it uses unsafe function `offset_from`. Under certain
/// conditions, this function can cause undefined behavior. See the documentation of
/// `offset_from` for more information.
pub unsafe fn ptr_offset(&self) -> usize {
self.ptr.offset_from(self.data.ptr().as_ptr()) as usize
pub fn ptr_offset(&self) -> usize {
// Safety: `ptr` is always in bounds of `data`.
unsafe { self.ptr.offset_from(self.data.ptr().as_ptr()) as usize }
}

/// Returns the pointer to the start of the buffer without the offset.
Expand Down

0 comments on commit 4959548

Please sign in to comment.