[−][src]Enum jlrs::value::array::Dimensions
The dimensions of an n-dimensional array, they represent either the shape of an array or an
index. Functions that need Dimensions
as an input, which is currently limited to just
indexing this data, are generic and accept any type that implements Into<Dimensions>
.
For a single dimension, you can use a usize
value. For 0 up to and including 8 dimensions,
you can use tuples of usize
. In general, you can use slices of usize
:
let _0d: Dimensions = ().into(); let _1d_value: Dimensions = 42.into(); let _1d_tuple: Dimensions = (42,).into(); let _2d: Dimensions = (42, 6).into(); let _nd: Dimensions = [42, 6, 12, 3].as_ref().into();
Implementations
impl Dimensions
[src]
pub fn n_dimensions(&self) -> usize
[src]
Returns the number of dimensions.
pub fn n_elements(&self, dimension: usize) -> usize
[src]
Returns the number of elements of the nth dimension. Indexing starts at 0.
pub fn size(&self) -> usize
[src]
The product of the number of elements of each dimension.
pub fn index_of<D: Into<Dimensions>>(&self, dim_index: D) -> JlrsResult<usize>
[src]
Calculates the linear index of dim_index
corresponding to a multidimensional array of
shape self
. Returns an error if the index is not valid for this shape.
pub fn as_slice(&self) -> &[usize]
[src]
Returns the raw dimensions as a slice.
Trait Implementations
impl Clone for Dimensions
[src]
fn clone(&self) -> Dimensions
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Dimensions
[src]
impl Display for Dimensions
[src]
impl Into<Dimensions> for usize
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for ()
[src]
fn into(self) -> Dimensions
[src]
impl<'_> Into<Dimensions> for &'_ [usize]
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize,)
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize, usize)
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize, usize, usize)
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize, usize, usize, usize)
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize, usize, usize, usize, usize)
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize, usize, usize, usize, usize, usize)
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize, usize, usize, usize, usize, usize, usize)
[src]
fn into(self) -> Dimensions
[src]
impl Into<Dimensions> for (usize, usize, usize, usize, usize, usize, usize, usize)
[src]
fn into(self) -> Dimensions
[src]
Auto Trait Implementations
impl RefUnwindSafe for Dimensions
impl Send for Dimensions
impl Sync for Dimensions
impl Unpin for Dimensions
impl UnwindSafe for Dimensions
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,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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>,