#![allow(unsafe_op_in_unsafe_fn)]
mod array;
mod bridge;
mod generated;
pub mod mmap;
mod schema;
mod stream;
pub(crate) use array::{ArrowArrayRef, InternalArrowArray, try_from};
pub(crate) use bridge::align_to_c_data_interface;
pub use generated::{ArrowArray, ArrowArrayStream, ArrowSchema};
use polars_error::PolarsResult;
pub use stream::{ArrowArrayStreamReader, export_iterator};
use self::schema::to_field;
use crate::array::Array;
use crate::datatypes::{ArrowDataType, Field};
pub fn export_array_to_c(array: Box<dyn Array>) -> ArrowArray {
ArrowArray::new(bridge::align_to_c_data_interface(array))
}
pub fn export_field_to_c(field: &Field) -> ArrowSchema {
ArrowSchema::new(field)
}
pub unsafe fn import_field_from_c(field: &ArrowSchema) -> PolarsResult<Field> {
to_field(field)
}
pub unsafe fn import_array_from_c(
array: ArrowArray,
dtype: ArrowDataType,
) -> PolarsResult<Box<dyn Array>> {
try_from(InternalArrowArray::new(array, dtype))
}