pub enum SliceElement {
    SingleIndex(i64),
    SubArray(Option<i64>, Option<i64>, Option<i64>),
    Ellipsis,
}
Expand description

This enum represents different types of slice elements that are used to create indexing slices (see Slice and Graph::get_slice).

The semantics is similar to the NumPy slice indexing.

Variants

SingleIndex(i64)

Single index of a given array dimension.

The index is given by a signed integer. If negative, the index is interpreted as in NumPy.

For example, to choose all the elements of an array with the last index in the first dimension and the first index in the second dimension, one can use a slice vec![SingleIndex(-1), SingleIndex(0)].

SubArray(Option<i64>, Option<i64>, Option<i64>)

Sub-array denotes a range of indices of a given array dimension.

It follows the description of the NumPy basic slice, which is defined by 3 signed integers: start, stop, step. step can’t be equal to zero.

For example, to choose all the elements of an array with even indices in the first dimension, one can use a slice `vec![SubArray(Some(0), None, Some(2))].

Ellipsis

Ellipsis denotes several dimensions where indices are not restricted.

For example, to choose all the elements of an array with index 0 in the first dimension and index 2 in the last dimension, one can use a slice vec![SingleIndex(0), Ellipsis, SingleIndex(2)].

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

Deserialize this value from the given Serde deserializer. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. 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

Compare self to key and return true if they are equal.

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

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