Struct ndarray::SliceInfo [−][src]
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.
Trait Implementations
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: &'a [SliceInfoElem]
) -> Result<SliceInfo<&'a [SliceInfoElem], Din, Dout>, ShapeError>
fn try_from(
    indices: &'a [SliceInfoElem]
) -> Result<SliceInfo<&'a [SliceInfoElem], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 0]
) -> Result<SliceInfo<[SliceInfoElem; 0], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 0]
) -> Result<SliceInfo<[SliceInfoElem; 0], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 1]
) -> Result<SliceInfo<[SliceInfoElem; 1], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 1]
) -> Result<SliceInfo<[SliceInfoElem; 1], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 2]
) -> Result<SliceInfo<[SliceInfoElem; 2], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 2]
) -> Result<SliceInfo<[SliceInfoElem; 2], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 3]
) -> Result<SliceInfo<[SliceInfoElem; 3], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 3]
) -> Result<SliceInfo<[SliceInfoElem; 3], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 4]
) -> Result<SliceInfo<[SliceInfoElem; 4], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 4]
) -> Result<SliceInfo<[SliceInfoElem; 4], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 5]
) -> Result<SliceInfo<[SliceInfoElem; 5], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 5]
) -> Result<SliceInfo<[SliceInfoElem; 5], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 6]
) -> Result<SliceInfo<[SliceInfoElem; 6], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 6]
) -> Result<SliceInfo<[SliceInfoElem; 6], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 7]
) -> Result<SliceInfo<[SliceInfoElem; 7], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 7]
) -> Result<SliceInfo<[SliceInfoElem; 7], Din, Dout>, ShapeError>
Performs the conversion.
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: [SliceInfoElem; 8]
) -> Result<SliceInfo<[SliceInfoElem; 8], Din, Dout>, ShapeError>
fn try_from(
    indices: [SliceInfoElem; 8]
) -> Result<SliceInfo<[SliceInfoElem; 8], Din, Dout>, ShapeError>
Performs the conversion.
impl<Din, Dout> TryFrom<Vec<SliceInfoElem, Global>> for SliceInfo<Vec<SliceInfoElem>, Din, Dout> where
    Din: Dimension,
    Dout: Dimension, 
impl<Din, Dout> TryFrom<Vec<SliceInfoElem, Global>> for SliceInfo<Vec<SliceInfoElem>, Din, Dout> where
    Din: Dimension,
    Dout: Dimension, 
type Error = ShapeError
type Error = ShapeError
The type returned in the event of a conversion error.
fn try_from(
    indices: Vec<SliceInfoElem>
) -> Result<SliceInfo<Vec<SliceInfoElem>, Din, Dout>, ShapeError>
fn try_from(
    indices: Vec<SliceInfoElem>
) -> Result<SliceInfo<Vec<SliceInfoElem>, Din, Dout>, ShapeError>
Performs the conversion.
Auto Trait Implementations
impl<T, Din, Dout> RefUnwindSafe for SliceInfo<T, Din, Dout> where
    Din: RefUnwindSafe,
    Dout: RefUnwindSafe,
    T: RefUnwindSafe, 
impl<T, Din, Dout> UnwindSafe for SliceInfo<T, Din, Dout> where
    Din: UnwindSafe,
    Dout: UnwindSafe,
    T: UnwindSafe, 
Blanket Implementations
Mutably borrows from an owned value. Read more