summaryrefslogtreecommitdiff
path: root/rust/src/data_buffer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/data_buffer.rs')
-rw-r--r--rust/src/data_buffer.rs7
1 files changed, 7 insertions, 0 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());