pub struct ParallelVec<Param: ParallelVecParam> { /* private fields */ }
Expand description

A contiguously growable heterogenous array type.

This type stores the values [structure of arrays] layout. This layout may improve cache utilizatoin in specific use cases, which may have.

Unlike a struct of Vecs, this type allocates memory for the all individual fields simultaneously. This may minimize memory fragmentation and decrease allocation pressure. It also only stores one length and capacity instead of duplicating the values across multiple Vec fields.

Implementations

Constructs a new, empty ParallelVec.

The vector will not allocate until elements are pushed onto it.

Constructs a new, empty ParallelVec with the specified capacity.

The vector will be able to hold exactly capacity elements without reallocating. If capacity is 0, the vector will not allocate.

It is important to note that although the returned vector has the capacity specified, the vector will have a zero length.

Returns the number of elements in the vector, also referred to as its ‘length’.

Returns true if the vector contains no elements.

Returns the number of elements the vector can hold without reallocating.

Clears the vector, removing all values.

Note that this method has no effect on the allocated capacity of the vector.

Returns a immutable reference to the element at index, if available, or None if it is out of bounds.

Returns a mutable reference to the element at index, if available, or None if it is out of bounds.

Returns the first element of the ParallelVec, or None if it is empty.

Returns the mutable pointer first element of the ParallelVec, or None if it is empty.

Returns the last element of the ParallelVec, or None if it is empty.

Returns the mutable pointer last element of the ParallelVec, or None if it is empty.

Gets a immutable reference to the elements at index.

Panics

This function will panic if index is >= self.len.

Gets a mutable reference to the elements at index.

Panics

This function will panic if index is >= self.len.

Returns references to elements, without doing bounds checking.

For a safe alternative see get.

Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Returns mutable references to elements, without doing bounds checking.

For a safe alternative see get_mut.

Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Returns a raw pointer to the slice’s buffer.

The caller must ensure that the slice outlives the pointer this function returns, or else it will end up pointing to garbage.

Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.

Gets the individual slices for very sub-Vec.

Gets mutable individual slices for very sub-Vec.

Swaps two elements.

Arguments
  • a - The index of the first element
  • b - The index of the second element
Panics

Panics if a or b are out of bounds.

Swaps two elements in the slice, without doing bounds checking.

For a safe alternative see swap.

Arguments
  • a - The index of the first element
  • b - The index of the second element
Safety

Calling this method with an out-of-bounds index is undefined behavior. The caller has to ensure that a < self.len() and b < self.len().

Shortens the vector, keeping the first len elements and dropping the rest.

If len is greater than the vector’s current length, this has no effect.

Note that this method has no effect on the allocated capacity of the vector.

Reverses the order of elements in the ParallelVec, in place.

This is a O(n) operation.

Shrinks the capacity of the vector with a lower bound.

The capacity will remain at least as large as both the length and the supplied value.

If the current capacity is less than the lower limit, this is a no-op.

Swaps all elements in self with those in other.

The length of other must be the same as self.

Panics

This function will panic if the two slices have different lengths.

Shrinks the capacity of the vector as much as possible.

It will drop down as close as possible to the length but the allocator may still inform the vector that there is space for a few more elements.

Moves all the elements of other into Self, leaving other empty.

Appends an element to the back of a collection.

Removes the last element from the vector and returns it, or None if it is empty.

Removes an element from the vector and returns it.

The removed element is replaced by the last element of the vector.

This does not preserve ordering, but is O(1). If you need to preserve the element order, use remove instead.

Inserts a value at index. Moves all of the elements above index up one index. This is a O(N) operation.

Panics

This function will panic if index is greater than or equal to len().

Removes a value at index. Moves all of the elements above index down one index. This is a O(N) operation.

Returns None if index is is greater than or equal to len().

Reserves capacity for at least additional more elements to be inserted in the given ParallelVec. The collection may reserve more space to avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.

Returns an iterator over the ParallelVec.

Returns an iterator that allows modifying each value.

Returns an iterator over the ParallelVec.

Gets individual iterators.

Creates a ParallelVec by repeating self n times.

Fills self with elements by cloning value.

Fills self with elements returned by calling a closure repeatedly.

This method uses a closure to create new values. If you’d rather Clone a given value, use fill. If you want to use the Default trait to generate values, you can pass Default::default as the argument.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Executes the destructor for this 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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. 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.

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.

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.

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.

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.

The type returned in the event of a conversion error.

Performs the conversion.

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 resulting type after obtaining ownership.

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

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

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.