polars_arrow::ffi::mmap

Function slice_and_owner

Source
pub unsafe fn slice_and_owner<T: NativeType, O>(
    slice: &[T],
    owner: O,
) -> PrimitiveArray<T>
Expand description

Creates a (non-null) PrimitiveArray from a slice of values. This does not have memcopy and is the fastest way to create a PrimitiveArray.

This can be useful if you want to apply arrow kernels on slices without incurring a memcopy cost.

ยงSafety

The caller must ensure the passed owner ensures the data remains alive.