Struct arrow::ffi::ArrowArray
source · [−]pub struct ArrowArray { /* private fields */ }
Expand description
Struct used to move an Array from and to the C Data Interface. Its main responsibility is to expose functionality that requires both FFI_ArrowArray and FFI_ArrowSchema.
This struct has two main paths:
Import from the C Data Interface
- ArrowArray::empty to allocate memory to be filled by an external call
- ArrowArray::try_from_raw to consume two non-null allocated pointers
Export to the C Data Interface
- ArrowArray::try_new to create a new ArrowArray from Rust-specific information
- ArrowArray::into_raw to expose two pointers for FFI_ArrowArray and FFI_ArrowSchema.
Safety
Whoever creates this struct is responsible for releasing their resources. Specifically, consumers must call ArrowArray::into_raw and take ownership of the individual pointers, calling FFI_ArrowArray::release and FFI_ArrowSchema::release accordingly.
Furthermore, this struct assumes that the incoming data agrees with the C data interface.
Implementations
sourceimpl ArrowArray
impl ArrowArray
sourcepub unsafe fn try_new(data: ArrayData) -> Result<Self>
pub unsafe fn try_new(data: ArrayData) -> Result<Self>
creates a new ArrowArray
. This is used to export to the C Data Interface.
Safety
See safety of ArrowArray
sourcepub unsafe fn try_from_raw(
array: *const FFI_ArrowArray,
schema: *const FFI_ArrowSchema
) -> Result<Self>
pub unsafe fn try_from_raw(
array: *const FFI_ArrowArray,
schema: *const FFI_ArrowSchema
) -> Result<Self>
creates a new ArrowArray from two pointers. Used to import from the C Data Interface.
Safety
See safety of ArrowArray
Note that this function will copy the content pointed by the raw pointers. Considering
the raw pointers can be from Arc::into_raw
or other raw pointers, users must be responsible
on managing the allocation of the structs by themselves.
Error
Errors if any of the pointers is null
sourcepub unsafe fn empty() -> Self
pub unsafe fn empty() -> Self
creates a new empty ArrowArray. Used to import from the C Data Interface.
Safety
See safety of ArrowArray
sourcepub fn into_raw(
this: ArrowArray
) -> (*const FFI_ArrowArray, *const FFI_ArrowSchema)
pub fn into_raw(
this: ArrowArray
) -> (*const FFI_ArrowArray, *const FFI_ArrowSchema)
exports ArrowArray to the C Data Interface
Trait Implementations
sourceimpl ArrowArrayRef for ArrowArray
impl ArrowArrayRef for ArrowArray
fn array(&self) -> &FFI_ArrowArray
fn schema(&self) -> &FFI_ArrowSchema
fn owner(&self) -> &Arc<FFI_ArrowArray>
fn to_data(&self) -> Result<ArrayData>
sourcefn buffers(&self) -> Result<Vec<Buffer>>
fn buffers(&self) -> Result<Vec<Buffer>>
returns all buffers, as organized by Rust (i.e. null buffer is skipped)
sourcefn buffer_len(&self, i: usize) -> Result<usize>
fn buffer_len(&self, i: usize) -> Result<usize>
Returns the length, in bytes, of the buffer i
(indexed according to the C data interface)
sourcefn null_bit_buffer(&self) -> Option<Buffer>
fn null_bit_buffer(&self) -> Option<Buffer>
returns the null bit buffer. Rust implementation uses a buffer that is not part of the array of buffers. The C Data interface’s null buffer is part of the array of buffers. Read more
fn child(&self, index: usize) -> ArrowArrayChild<'_>
fn dictionary(&self) -> Option<ArrowArrayChild<'_>>
sourceimpl Debug for ArrowArray
impl Debug for ArrowArray
sourceimpl TryFrom<ArrayData> for ArrowArray
impl TryFrom<ArrayData> for ArrowArray
sourceimpl TryFrom<ArrowArray> for ArrayData
impl TryFrom<ArrowArray> for ArrayData
type Error = ArrowError
type Error = ArrowError
The type returned in the event of a conversion error.
sourcefn try_from(value: ArrowArray) -> Result<Self>
fn try_from(value: ArrowArray) -> Result<Self>
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for ArrowArray
impl !Send for ArrowArray
impl !Sync for ArrowArray
impl Unpin for ArrowArray
impl UnwindSafe for ArrowArray
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more