#![deny(missing_docs)]
mod array;
#[allow(clippy::module_inception)]
mod ffi;
mod schema;
pub(crate) use array::try_from;
pub(crate) use ffi::{ArrowArray, ArrowArrayRef};
use std::sync::Arc;
use crate::array::Array;
use crate::datatypes::Field;
use crate::error::Result;
pub use ffi::Ffi_ArrowArray;
pub use schema::Ffi_ArrowSchema;
use self::schema::to_field;
pub unsafe fn export_array_to_c(array: Arc<dyn Array>, ptr: *mut Ffi_ArrowArray) {
*ptr = Ffi_ArrowArray::new(array);
}
pub unsafe fn export_field_to_c(field: &Field, ptr: *mut Ffi_ArrowSchema) {
*ptr = Ffi_ArrowSchema::new(field)
}
pub unsafe fn import_field_from_c(field: &Ffi_ArrowSchema) -> Result<Field> {
to_field(field)
}
pub unsafe fn import_array_from_c(
array: Box<Ffi_ArrowArray>,
field: &Field,
) -> Result<Box<dyn Array>> {
try_from(Arc::new(ArrowArray::new(array, field.clone())))
}