fn new(data: &ArrayData) -> Self {
        // * insert the null buffer at the start
        // * make all others `Option<Buffer>`.
        let buffers = iter::once(data.null_buffer().cloned())
            .chain(data.buffers().iter().map(|b| Some(b.clone())))
            .collect::<Vec<_>>();
        let n_buffers = buffers.len() as i64;

        let buffers_ptr = buffers
            .iter()
            .map(|maybe_buffer| match maybe_buffer {
                // note that `raw_data` takes into account the buffer's offset
                Some(b) => b.as_ptr() as *const std::os::raw::c_void,
                None => std::ptr::null(),
            })
            .collect::<Box<[_]>>();

        let children = data
            .child_data()
            .iter()
            .map(|child| Box::into_raw(Box::new(FFI_ArrowArray::new(child))))
            .collect::<Box<_>>();
        let n_children = children.len() as i64;

        // create the private data owning everything.
        // any other data must be added here, e.g. via a struct, to track lifetime.
        let mut private_data = Box::new(PrivateData {
            buffers,
            buffers_ptr,
            children,
        });

        Self {
            length: data.len() as i64,
            null_count: data.null_count() as i64,
            offset: data.offset() as i64,
            n_buffers,
            n_children,
            buffers: private_data.buffers_ptr.as_mut_ptr(),
            children: private_data.children.as_mut_ptr(),
            dictionary: std::ptr::null_mut(),
            release: Some(release_array),
            private_data: Box::into_raw(private_data) as *mut ::std::os::raw::c_void,
        }
    }
/// creates a new `FFI_ArrowArray` from existing data.
/// # Safety
/// This method releases `buffers`. Consumers of this struct *must* call `release` before
/// releasing this struct, or contents in `buffers` leak.
creates a new `FFI_ArrowArray` from existing data.
creates a new ` FFI_ArrowArray ` from existing data .
fn new(data: &ArrayData) -> Self {
        // * insert the null buffer at the start
        // * make all others `Option<Buffer>`.
        let buffers = iter::once(data.null_buffer().cloned())
            .chain(data.buffers().iter().map(|b| Some(b.clone())))
            .collect::<Vec<_>>();
        let n_buffers = buffers.len() as i64;
        let buffers_ptr = buffers
            .iter()
            .map(|maybe_buffer| match maybe_buffer {
                // note that `raw_data` takes into account the buffer's offset
                Some(b) => b.as_ptr() as *const std::os::raw::c_void,
                None => std::ptr::null(),
            })
            .collect::<Box<[_]>>();
        let children = data
            .child_data()
            .iter()
            .map(|child| Box::into_raw(Box::new(FFI_ArrowArray::new(child))))
            .collect::<Box<_>>();
        let n_children = children.len() as i64;
        // create the private data owning everything.
        // any other data must be added here, e.g. via a struct, to track lifetime.
        let mut private_data = Box::new(PrivateData {
            buffers,
            buffers_ptr,
            children,
        });
        Self {
            length: data.len() as i64,
            null_count: data.null_count() as i64,
            offset: data.offset() as i64,
            n_buffers,
            n_children,
            buffers: private_data.buffers_ptr.as_mut_ptr(),
            children: private_data.children.as_mut_ptr(),
            dictionary: std::ptr::null_mut(),
            release: Some(release_array),
            private_data: Box::into_raw(private_data) as *mut ::std::os::raw::c_void,
        }
    }
fn new ( data : & ArrayData ) -> Self { // * insert the null buffer at the start // * make all others `Option<Buffer>`. let buffers = iter :: once ( data . null_buffer ( ) . cloned ( ) ) . chain ( data . buffers ( ) . iter ( ) . map ( | b | Some ( b . clone ( ) ) ) ) . collect :: < Vec < _ > > ( ) ; let n_buffers = buffers . len ( ) as i64 ; let buffers_ptr = buffers . iter ( ) . map ( | maybe_buffer | match maybe_buffer { // note that `raw_data` takes into account the buffer's offset Some ( b ) => b . as_ptr ( ) as * const std :: os :: raw :: c_void , None => std :: ptr :: null ( ) , } ) . collect :: < Box < [ _ ] > > ( ) ; let children = data . child_data ( ) . iter ( ) . map ( | child | Box :: into_raw ( Box :: new ( FFI_ArrowArray :: new ( child ) ) ) ) . collect :: < Box < _ > > ( ) ; let n_children = children . len ( ) as i64 ; // create the private data owning everything. // any other data must be added here, e.g. via a struct, to track lifetime. let mut private_data = Box :: new ( PrivateData { buffers , buffers_ptr , children , } ) ; Self { length : data . len ( ) as i64 , null_count : data . null_count ( ) as i64 , offset : data . offset ( ) as i64 , n_buffers , n_children , buffers : private_data . buffers_ptr . as_mut_ptr ( ) , children : private_data . children . as_mut_ptr ( ) , dictionary : std :: ptr :: null_mut ( ) , release : Some ( release_array ) , private_data : Box :: into_raw ( private_data ) as * mut :: std :: os :: raw :: c_void , } }
creates a new `FFI_ArrowArray` from existing data.
creates a new ` FFI_ArrowArray ` from existing data .
data
&ArrayData
data
&ArrayData
safety
This method releases `buffers`. Consumers of this struct *must* call `release` before
releasing this struct, or contents in `buffers` leak.
This method releases ` buffers ` . Consumers of this struct * must * call ` release ` before releasing this struct or contents in ` buffers ` leak .