Enum ndarray::SliceInfoElem [−][src]
A slice (range with step), an index, or a new axis token.
See also the s![] macro for a convenient way to create a
SliceInfo<[SliceInfoElem; n], Din, Dout>.
Examples
SliceInfoElem::Index(a) is the index a. It can also be created with
SliceInfoElem::from(a). The Python equivalent is [a]. The macro
equivalent is s![a].
SliceInfoElem::Slice { start: 0, end: None, step: 1 } is the full range
of an axis. It can also be created with SliceInfoElem::from(..). The
Python equivalent is [:]. The macro equivalent is s![..].
SliceInfoElem::Slice { start: a, end: Some(b), step: 2 } is every second
element from a until b. It can also be created with
SliceInfoElem::from(Slice::from(a..b).step_by(2)). The Python equivalent
is [a:b:2]. The macro equivalent is s![a..b;2].
SliceInfoElem::Slice { start: a, end: None, step: -1 } is every element,
from a until the end, in reverse order. It can also be created with
SliceInfoElem::from(Slice::from(a..).step_by(-1)). The Python equivalent
is [a::-1]. The macro equivalent is s![a..;-1].
SliceInfoElem::NewAxis is a new axis of length 1. It can also be created
with SliceInfoElem::from(NewAxis). The Python equivalent is
[np.newaxis]. The macro equivalent is s![NewAxis].
Variants
A range with step size. end is an exclusive index. Negative begin
or end indexes are counted from the back of the axis. If end is
None, the slice extends to the end of the axis.
Index(isize)A single index.
A new axis of length 1.
Implementations
impl SliceInfoElem[src]
pub fn is_slice(&self) -> bool[src]
Returns true if self is a Slice value.
pub fn is_index(&self) -> bool[src]
Returns true if self is an Index value.
pub fn is_new_axis(&self) -> bool[src]
Returns true if self is a NewAxis value.
Trait Implementations
impl Clone for SliceInfoElem[src]
fn clone(&self) -> Self[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for SliceInfoElem[src]
impl Debug for SliceInfoElem[src]
impl Display for SliceInfoElem[src]
impl Eq for SliceInfoElem[src]
impl From<NewAxis> for SliceInfoElem[src]
fn from(_: NewAxis) -> SliceInfoElem[src]
impl From<Range<i32>> for SliceInfoElem[src]
fn from(r: Range<i32>) -> SliceInfoElem[src]
impl From<Range<isize>> for SliceInfoElem[src]
fn from(r: Range<isize>) -> SliceInfoElem[src]
impl From<Range<usize>> for SliceInfoElem[src]
fn from(r: Range<usize>) -> SliceInfoElem[src]
impl From<RangeFrom<i32>> for SliceInfoElem[src]
fn from(r: RangeFrom<i32>) -> SliceInfoElem[src]
impl From<RangeFrom<isize>> for SliceInfoElem[src]
fn from(r: RangeFrom<isize>) -> SliceInfoElem[src]
impl From<RangeFrom<usize>> for SliceInfoElem[src]
fn from(r: RangeFrom<usize>) -> SliceInfoElem[src]
impl From<RangeFull> for SliceInfoElem[src]
fn from(_: RangeFull) -> SliceInfoElem[src]
impl From<RangeInclusive<i32>> for SliceInfoElem[src]
fn from(r: RangeInclusive<i32>) -> SliceInfoElem[src]
impl From<RangeInclusive<isize>> for SliceInfoElem[src]
fn from(r: RangeInclusive<isize>) -> SliceInfoElem[src]
impl From<RangeInclusive<usize>> for SliceInfoElem[src]
fn from(r: RangeInclusive<usize>) -> SliceInfoElem[src]
impl From<RangeTo<i32>> for SliceInfoElem[src]
fn from(r: RangeTo<i32>) -> SliceInfoElem[src]
impl From<RangeTo<isize>> for SliceInfoElem[src]
fn from(r: RangeTo<isize>) -> SliceInfoElem[src]
impl From<RangeTo<usize>> for SliceInfoElem[src]
fn from(r: RangeTo<usize>) -> SliceInfoElem[src]
impl From<RangeToInclusive<i32>> for SliceInfoElem[src]
fn from(r: RangeToInclusive<i32>) -> SliceInfoElem[src]
impl From<RangeToInclusive<isize>> for SliceInfoElem[src]
fn from(r: RangeToInclusive<isize>) -> SliceInfoElem[src]
impl From<RangeToInclusive<usize>> for SliceInfoElem[src]
fn from(r: RangeToInclusive<usize>) -> SliceInfoElem[src]
impl From<Slice> for SliceInfoElem[src]
fn from(s: Slice) -> SliceInfoElem[src]
impl From<i32> for SliceInfoElem[src]
fn from(r: i32) -> SliceInfoElem[src]
impl From<isize> for SliceInfoElem[src]
fn from(r: isize) -> SliceInfoElem[src]
impl From<usize> for SliceInfoElem[src]
fn from(r: usize) -> SliceInfoElem[src]
impl Hash for SliceInfoElem[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<SliceInfoElem> for SliceInfoElem[src]
fn eq(&self, other: &SliceInfoElem) -> bool[src]
fn ne(&self, other: &SliceInfoElem) -> bool[src]
impl StructuralEq for SliceInfoElem[src]
impl StructuralPartialEq for SliceInfoElem[src]
Auto Trait Implementations
impl RefUnwindSafe for SliceInfoElem
impl Send for SliceInfoElem
impl Sync for SliceInfoElem
impl Unpin for SliceInfoElem
impl UnwindSafe for SliceInfoElem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,