Struct ndarray::SliceInfo
[−]
[src]
#[repr(C)]pub struct SliceInfo<T: ?Sized, D: Dimension> { /* fields omitted */ }
Represents all of the necessary information to perform a slice.
The type T
is typically [SliceOrIndex; n]
, [SliceOrIndex]
, or
Vec<SliceOrIndex>
. The type D
is the output dimension after calling
.slice()
.
Methods
impl<T, D> SliceInfo<T, D> where
T: AsRef<[SliceOrIndex]>,
D: Dimension,
[src]
T: AsRef<[SliceOrIndex]>,
D: Dimension,
pub fn new(indices: T) -> Result<SliceInfo<T, D>, ShapeError>
[src]
Returns a new SliceInfo
instance.
Errors if D
is not consistent with indices
.
impl<T: ?Sized, D> SliceInfo<T, D> where
T: AsRef<[SliceOrIndex]>,
D: Dimension,
[src]
T: AsRef<[SliceOrIndex]>,
D: Dimension,
pub fn out_ndim(&self) -> usize
[src]
Returns the number of dimensions after calling
.slice()
(including taking
subviews).
If D
is a fixed-size dimension type, then this is equivalent to
D::NDIM.unwrap()
. Otherwise, the value is calculated by iterating
over the ranges/indices.
Trait Implementations
impl<T: Debug + ?Sized, D: Debug + Dimension> Debug for SliceInfo<T, D>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: ?Sized, D> Deref for SliceInfo<T, D> where
D: Dimension,
[src]
D: Dimension,
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Dereferences the value.
impl<T, D> AsRef<[SliceOrIndex]> for SliceInfo<T, D> where
T: AsRef<[SliceOrIndex]>,
D: Dimension,
[src]
T: AsRef<[SliceOrIndex]>,
D: Dimension,
fn as_ref(&self) -> &[SliceOrIndex]
[src]
Performs the conversion.
impl<T, D> AsRef<SliceInfo<[SliceOrIndex], D>> for SliceInfo<T, D> where
T: AsRef<[SliceOrIndex]>,
D: Dimension,
[src]
T: AsRef<[SliceOrIndex]>,
D: Dimension,
impl<T, D> Copy for SliceInfo<T, D> where
T: Copy,
D: Dimension,
[src]
T: Copy,
D: Dimension,
impl<T, D> Clone for SliceInfo<T, D> where
T: Clone,
D: Dimension,
[src]
T: Clone,
D: Dimension,