polars_arrow::ffi::mmap

Function slice

Source
pub unsafe fn slice<T: NativeType>(slice: &[T]) -> 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

Using this function is not unsafe, but the returned PrimitiveArray’s lifetime is bound to the lifetime of the slice. The returned PrimitiveArray must not outlive the passed slice.