pitrou commented on code in PR #5082:
URL: https://github.com/apache/arrow-rs/pull/5082#discussion_r1395620068
##########
arrow-data/src/ffi.rs:
##########
@@ -191,6 +191,22 @@ impl FFI_ArrowArray {
}
}
+ /// Takes ownership of the pointed to [`FFI_ArrowArray`]
+ ///
+ /// This acts to [move] the data out of `array`, setting the release
callback to NULL
+ ///
+ /// # Safety
+ ///
+ /// * `array` must be [valid] for reads and writes
+ /// * `array` must be properly aligned
+ /// * `array` must point to a properly initialized value of
[`FFI_ArrowArray`]
+ ///
+ /// [move]:
https://arrow.apache.org/docs/format/CDataInterface.html#moving-an-array
+ /// [valid]: https://doc.rust-lang.org/std/ptr/index.html#safety
+ pub unsafe fn from_raw(array: *mut FFI_ArrowArray) -> Self {
+ std::ptr::replace(array, Self::empty())
Review Comment:
Asserting that the release pointer isn't NULL sounds good to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]