#[repr(C)]
pub struct ParallelSlice<'a, Param: ParallelParam> { /* private fields */ }
Expand description

A immutable dynamically-sized view into a contiguous heterogeneous sequence. Contiguous here means that elements are laid out so that every element is the same distance from its neighbors.

Unlike a struct of slices, this type only stores one length instead of duplicating the values across multiple slice fields.

Implementations

Forms a slice from a pointer and a length.

The len argument is the number of elements, not the number of bytes.

Safety

Behavior is undefined if any of the following conditions are violated:

  • data must be valid for both reads and writes for len * mem::size_of::<T>() many bytes, and it must be properly aligned. This means in particular:

    • The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects.
    • data must be non-null and aligned even for zero-length slices. One reason for this is that enum layout optimizations may rely on references (including slices of any length) being aligned and non-null to distinguish them from other data. You can obtain a pointer that is usable as data for zero-length slices using ParallelParam::dangling().
  • data must point to len consecutive properly initialized values of type Param.

  • The memory referenced by the returned slice must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime 'a. Both read and write accesses are forbidden.

  • The total size len * mem::size_of::<T>() of the slice must be no larger than isize::MAX.

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

Returns true if the vector contains no elements.

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

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

Returns the last element of the slice, 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.

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.

Gets the individual slices for every sub-slice.

Returns an iterator over the ParallelSlice.

Returns an iterator over the ParallelSlice.

Trait Implementations

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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 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.