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§
Source§impl Clone for SliceElement
impl Clone for SliceElement
Source§fn clone(&self) -> SliceElement
fn clone(&self) -> SliceElement
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SliceElement
impl Debug for SliceElement
Source§impl<'de> Deserialize<'de> for SliceElement
impl<'de> Deserialize<'de> for SliceElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SliceElement
impl PartialEq for SliceElement
Source§impl Serialize for SliceElement
impl Serialize for SliceElement
impl Eq for SliceElement
impl StructuralPartialEq for SliceElement
Auto Trait Implementations§
impl Freeze for SliceElement
impl RefUnwindSafe for SliceElement
impl Send for SliceElement
impl Sync for SliceElement
impl Unpin for SliceElement
impl UnwindSafe for SliceElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.