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_len must be less than or equal to capacity.
  • The elements at old_len..new_len must be initialized.

Transform this array to an Arrow Buffer.

Panic

Must be a trusted len iterator or else it will panic

Extend this Vector with an iterator whose length can be trusted.

Safety

  • iterator must be TrustedLen

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Creates a value from an iterator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.