pub struct MutablePrimitiveArray<T: NativeType> { /* private fields */ }
Expand description

The Arrow’s equivalent to Vec<Option<T>> where T is byte-size (e.g. i32). Converting a MutablePrimitiveArray into a PrimitiveArray is O(1).

Implementations

Returns an iterator over Option<T>

Returns an iterator of bool

Creates a new empty MutablePrimitiveArray.

Creates a new MutablePrimitiveArray with a capacity.

Create a MutablePrimitiveArray out of low-end APIs.

Panics

This function panics iff:

  • data_type is not supported by the physical type
  • The validity is not None and its length is different from the values’s length

Extract the low-end APIs from the MutablePrimitiveArray.

Applies a function f to the values of this array, cloning the values iff they are being shared with others

This is an API to use clone-on-write

Implementation

This function is O(f) if the data is not being shared, and O(N) + O(f) if it is being shared (since it results in a O(N) memcopy).

Panics

This function panics iff f panics

Creates a new MutablePrimitiveArray from a capacity and DataType.

Reserves additional entries.

Adds a new value to the array.

Pop a value from the array. Note if the values is empty, this method will return None.

Extends the MutablePrimitiveArray with a constant

Extends the MutablePrimitiveArray from an iterator of trusted len.

Extends the MutablePrimitiveArray from an iterator of trusted len.

Safety

The iterator must be trusted len.

Extends the MutablePrimitiveArray from an iterator of values of trusted len. This differs from extend_trusted_len which accepts in iterator of optional values.

Extends the MutablePrimitiveArray from an iterator of values of trusted len. This differs from extend_trusted_len_unchecked which accepts in iterator of optional values.

Safety

The iterator must be trusted len.

Extends the MutablePrimitiveArray from a slice

Changes the arrays’ DataType, returning a new MutablePrimitiveArray. Use to change the logical type without changing the corresponding physical Type.

Implementation

This operation is O(1).

Converts itself into an Array.

Shrinks the capacity of the MutablePrimitiveArray to fit its current length.

Returns the capacity of this MutablePrimitiveArray.

Accessors

Returns its values.

Returns a mutable slice of values.

Setters

Sets position index to value. Note that if it is the first time a null appears in this array, this initializes the validity bitmap (O(N)).

Panic

Panics iff index is larger than self.len().

Sets position index to value. Note that if it is the first time a null appears in this array, this initializes the validity bitmap (O(N)).

Safety

Caller must ensure index < self.len()

Sets the validity.

Panic

Panics iff the validity’s len is not equal to the existing values’ length.

Sets values.

Panic

Panics iff the values’ length is not equal to the existing validity’s len.

Creates a MutablePrimitiveArray from a slice of values.

Creates a MutablePrimitiveArray from an iterator of trusted length.

Safety

The iterator must be TrustedLen. I.e. size_hint().1 correctly reports its length.

Creates a MutablePrimitiveArray from an fallible iterator of trusted length.

Safety

The iterator must be TrustedLen. I.e. that size_hint().1 correctly reports its length.

Creates a MutablePrimitiveArray from an fallible iterator of trusted length.

Creates a new MutablePrimitiveArray out an iterator over values

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

Creates a new MutablePrimitiveArray from an iterator over values

Safety

The iterator must be TrustedLen. I.e. that size_hint().1 correctly reports its length.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

The length of the array.

The optional validity of the array.

Convert itself to an (immutable) Array.

Convert itself to an (immutable) atomically reference counted Array.

The DataType of the array.

Convert to Any, to enable dynamic casting.

Convert to mutable Any, to enable dynamic casting.

Adds a new null element to the array.

Reserves additional slots to its capacity.

Shrink the array to fit its length.

Whether the array is empty.

Whether index is valid / set. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This is infalible and is implemented for consistency with all other types

This is infalible and is implemented for consistency with all other types

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. 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.