Struct polars_core::prelude::AlignedVec [−][src]
pub struct AlignedVec<T> where
T: ArrowNativeType, { pub inner: Vec<T, Global>, // some fields omitted }
Expand description
A Vec wrapper with a memory alignment equal to Arrow’s primitive arrays.
Can be useful in creating a new ChunkedArray or Arrow Primitive array without copying.
Fields
inner: Vec<T, Global>Implementations
Uses a memcpy to initialize this AlignedVec
Create a new Vec where first bytes memory address has an alignment of 64 bytes, as described by arrow spec. Read more: https://github.com/rust-ndarray/ndarray/issues/771
Create a new aligned vec from a ptr.
Safety
The ptr should be 64 byte aligned and len and capacity should be correct otherwise it is UB.
Push at the end of the Vec. This is unsafe because a push when the capacity of the inner Vec is reached will reallocate the Vec without the alignment, leaving this destructor’s alignment incorrect
Set the length of the underlying Vec.
Safety
new_lenmust be less than or equal tocapacity.- The elements at
old_len..new_lenmust be initialized.
Transform this array to an Arrow Buffer.
pub fn into_primitive_array<A>(
self,
null_buf: Option<Buffer>
) -> PrimitiveArray<A> where
A: ArrowPrimitiveType,
Panic
Must be a trusted len iterator or else it will panic
pub unsafe fn extend_trusted_len_unchecked<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
pub unsafe fn extend_trusted_len_unchecked<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
Trait Implementations
Returns the “default value” for a type. Read more
Creates a value from an iterator. Read more