returns a new buffer corresponding to the index `i` of the FFI array. It may not exist (null pointer). `bits` is the number of bits that the native type of this buffer has. The size of the buffer will be `ceil(self.length * bits, 8)`. # Panic This function panics if `i` is larger or equal to `n_buffers`. # Safety This function assumes that `ceil(self.length * bits, 8)` is the size of the buffer
(
owner: Arc<FFI_ArrowArray>,
array: &FFI_ArrowArray,
index: usize,
len: usize,
)
| 255 | /// # Safety |
| 256 | /// This function assumes that `ceil(self.length * bits, 8)` is the size of the buffer |
| 257 | unsafe fn create_buffer( |
| 258 | owner: Arc<FFI_ArrowArray>, |
| 259 | array: &FFI_ArrowArray, |
| 260 | index: usize, |
| 261 | len: usize, |
| 262 | ) -> Option<Buffer> { |
| 263 | if array.num_buffers() == 0 { |
| 264 | return None; |
| 265 | } |
| 266 | NonNull::new(array.buffer(index) as _) |
| 267 | .map(|ptr| unsafe { Buffer::from_custom_allocation(ptr, len, owner) }) |
| 268 | } |
| 269 | |
| 270 | /// Export to the C Data Interface |
| 271 | pub fn to_ffi(data: &ArrayData) -> Result<(FFI_ArrowArray, FFI_ArrowSchema)> { |
no test coverage detected