logo
pub struct SliceInfo<T, Din: Dimension, Dout: Dimension> { /* private fields */ }
Expand description

Represents all of the necessary information to perform a slice.

The type T is typically [SliceInfoElem; n], &[SliceInfoElem], or Vec<SliceInfoElem>. The type Din is the dimension of the array to be sliced, and Dout is the output dimension after calling .slice(). Note that if Din is a fixed dimension type (Ix0, Ix1, Ix2, etc.), the SliceInfo instance can still be used to slice an array with dimension IxDyn as long as the number of axes matches.

Implementations

Returns a new SliceInfo instance.

Errors if Din or Dout is not consistent with indices.

For common types, a safe alternative is to use TryFrom instead.

Safety

The caller must ensure indices.as_ref() always returns the same value when called multiple times.

Returns the number of dimensions of the input array for .slice().

If Din is a fixed-size dimension type, then this is equivalent to Din::NDIM.unwrap(). Otherwise, the value is calculated by iterating over the SliceInfoElem elements.

Returns the number of dimensions after calling .slice() (including taking subviews).

If Dout is a fixed-size dimension type, then this is equivalent to Dout::NDIM.unwrap(). Otherwise, the value is calculated by iterating over the SliceInfoElem elements.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Converts to this type from the input type.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

Dimensionality of the output array.

Returns the number of axes in the input array.

Returns the number of axes in the output array.

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

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 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 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.