Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions foyer-storage/src/io/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,6 @@ impl Raw {
let cap = slice.len();
Self { ptr, cap }
}

/// Consume [`Raw`] and get the raw pointer and the capacity.
///
/// # Safety
///
/// [`Raw::from_raw_parts`] must be called later. Otherwise the buffer memory will leak.
pub fn into_raw_parts(self) -> (*mut u8, usize) {
let res = (self.ptr, self.cap);
std::mem::forget(self);
res
}

/// Construct [`Raw`] with the raw pointer and the capacity.
///
/// # Safety
///
/// The `ptr` and `cap` must be returned by [`Raw::into_raw_parts`].
pub unsafe fn from_raw_parts(ptr: *mut u8, cap: usize) -> Self {
Self { ptr, cap }
}
}

impl Clone for Raw {
Expand Down
Loading