Enum ciphercore_base::graphs::SliceElement
source · [−]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
sourceimpl Clone for SliceElement
impl Clone for SliceElement
sourcefn clone(&self) -> SliceElement
fn clone(&self) -> SliceElement
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SliceElement
impl Debug for SliceElement
sourceimpl<'de> Deserialize<'de> for SliceElement
impl<'de> Deserialize<'de> for SliceElement
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<SliceElement> for SliceElement
impl PartialEq<SliceElement> for SliceElement
sourcefn eq(&self, other: &SliceElement) -> bool
fn eq(&self, other: &SliceElement) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SliceElement) -> bool
fn ne(&self, other: &SliceElement) -> bool
This method tests for !=
.
sourceimpl Serialize for SliceElement
impl Serialize for SliceElement
impl Eq for SliceElement
impl StructuralEq for SliceElement
impl StructuralPartialEq for SliceElement
Auto Trait Implementations
impl RefUnwindSafe for SliceElement
impl Send for SliceElement
impl Sync for SliceElement
impl Unpin for SliceElement
impl UnwindSafe for SliceElement
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Serialize for T where
T: Serialize + ?Sized,
impl<T> Serialize for T where
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more