#[repr(C)]pub struct FFI_ArrowArrayStream {
get_schema: Option<unsafe extern "C" fn(arg1: *mut Self, out: *mut FFI_ArrowSchema) -> c_int>,
get_next: Option<unsafe extern "C" fn(arg1: *mut Self, out: *mut FFI_ArrowArray) -> c_int>,
get_last_error: Option<unsafe extern "C" fn(arg1: *mut Self) -> *const c_char>,
release: Option<unsafe extern "C" fn(arg1: *mut Self)>,
private_data: *mut c_void,
}Expand description
ABI-compatible struct for ArrayStream from C Stream Interface
See https://arrow.apache.org/docs/format/CStreamInterface.html#structure-definitions
This was created by bindgen
Fields§
§get_schema: Option<unsafe extern "C" fn(arg1: *mut Self, out: *mut FFI_ArrowSchema) -> c_int>C function to get schema from the stream
get_next: Option<unsafe extern "C" fn(arg1: *mut Self, out: *mut FFI_ArrowArray) -> c_int>C function to get next array from the stream
get_last_error: Option<unsafe extern "C" fn(arg1: *mut Self) -> *const c_char>C function to get the error from last operation on the stream
release: Option<unsafe extern "C" fn(arg1: *mut Self)>C function to release the stream
private_data: *mut c_voidPrivate data used by the stream, owned by the release callback.
Implementations§
Source§impl FFI_ArrowArrayStream
impl FFI_ArrowArrayStream
Sourcepub fn new(batch_reader: Box<dyn RecordBatchReader + Send>) -> Self
pub fn new(batch_reader: Box<dyn RecordBatchReader + Send>) -> Self
Creates a new FFI_ArrowArrayStream.
Sourcepub unsafe fn from_raw(raw_stream: *mut FFI_ArrowArrayStream) -> Self
pub unsafe fn from_raw(raw_stream: *mut FFI_ArrowArrayStream) -> Self
Takes ownership of the pointed to FFI_ArrowArrayStream
This acts to move the data out of raw_stream, setting the release callback to NULL
§Safety
raw_streammust be valid for reads and writesraw_streammust be properly alignedraw_streammust point to a properly initialized value ofFFI_ArrowArrayStream
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Creates a new empty FFI_ArrowArrayStream. Used to import from the C Stream Interface.
Sourcepub fn release(&self) -> Option<unsafe extern "C" fn(arg1: *mut Self)>
pub fn release(&self) -> Option<unsafe extern "C" fn(arg1: *mut Self)>
Returns the producer-provided release callback, if any.
Sourcepub fn private_data(&self) -> *mut c_void
pub fn private_data(&self) -> *mut c_void
Returns the opaque producer-provided private data pointer.
Sourcepub unsafe fn set_release(
&mut self,
release: Option<unsafe extern "C" fn(arg1: *mut Self)>,
) -> Option<unsafe extern "C" fn(arg1: *mut Self)>
pub unsafe fn set_release( &mut self, release: Option<unsafe extern "C" fn(arg1: *mut Self)>, ) -> Option<unsafe extern "C" fn(arg1: *mut Self)>
Replaces the release callback, returning the previous one.
Lets a consumer wrap release: save the old callback, install its own, and chain back on drop. See https://github.com/apache/arrow-rs/issues/9771.
§Safety
Drop calls this callback with a pointer to self. The new callback
must correctly release this stream (usually by chaining to the returned
one) and must match the FFI_ArrowArrayStream::private_data it reads.
A wrong callback is undefined behavior on drop.
Sourcepub unsafe fn set_private_data(
&mut self,
private_data: *mut c_void,
) -> *mut c_void
pub unsafe fn set_private_data( &mut self, private_data: *mut c_void, ) -> *mut c_void
Replaces the private data pointer, returning the previous one.
§Safety
The old pointer is returned without being freed; the caller owns it from
here. The new pointer must match what the current
FFI_ArrowArrayStream::release callback expects.