diff options
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/data_buffer.rs | 7 | ||||
| -rw-r--r-- | rust/src/project/file.rs | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/rust/src/data_buffer.rs b/rust/src/data_buffer.rs index 79b3b20b..f8d71088 100644 --- a/rust/src/data_buffer.rs +++ b/rust/src/data_buffer.rs @@ -32,6 +32,13 @@ impl DataBuffer { self.0 } + /// Return the raw pointer to the underlying data buffer, to be freed later with `BNFreeDataBuffer`. + pub fn into_raw(self) -> *mut BNDataBuffer { + let ptr = self.0; + std::mem::forget(self); + ptr + } + pub fn new(data: &[u8]) -> Self { let buffer = unsafe { BNCreateDataBuffer(data.as_ptr() as *const c_void, data.len()) }; assert!(!buffer.is_null()); diff --git a/rust/src/project/file.rs b/rust/src/project/file.rs index 22bf9b4b..d016d377 100644 --- a/rust/src/project/file.rs +++ b/rust/src/project/file.rs @@ -22,7 +22,7 @@ pub struct ProjectFile { } impl ProjectFile { - pub(crate) unsafe fn from_raw(handle: NonNull<BNProjectFile>) -> Self { + pub unsafe fn from_raw(handle: NonNull<BNProjectFile>) -> Self { Self { handle } } |
