Skip to content

Commit 587741f

Browse files
committed
Change names of the rank-related types
1 parent e4e4da3 commit 587741f

File tree

8 files changed

+155
-158
lines changed

8 files changed

+155
-158
lines changed

src/dimension/dimension_trait.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::conversion::Convert;
1717
use super::ops::DimAdd;
1818
use super::{stride_offset, stride_offset_checked};
1919
use crate::itertools::{enumerate, zip};
20-
use crate::layout::dimensionality::*;
20+
use crate::layout::rank::*;
2121
use crate::layout::ranked::Ranked;
2222
use crate::IntoDimension;
2323
use crate::RemoveAxis;
@@ -79,12 +79,6 @@ pub trait Dimension:
7979
/// Next larger dimension
8080
type Larger: Dimension + RemoveAxis;
8181

82-
/// Returns the number of dimensions (number of axes).
83-
fn ndim(&self) -> usize
84-
{
85-
self.rank()
86-
}
87-
8882
/// Convert the dimension into a pattern matching friendly value.
8983
fn into_pattern(self) -> Self::Pattern;
9084

@@ -421,12 +415,12 @@ macro_rules! impl_insert_axis_array(
421415
);
422416

423417
impl<const N: usize> Ranked for Dim<[Ix; N]>
424-
where NDim<N>: Dimensionality // Limit us to < 12, since Rank must impl Dimensionality
418+
where ConstRank<N>: Rank // Limit us to < 12, since Rank must impl Dimensionality
425419
{
426-
type Rank = NDim<N>;
420+
type NDim = ConstRank<N>;
427421

428422
#[inline]
429-
fn rank(&self) -> usize
423+
fn ndim(&self) -> usize
430424
{
431425
N
432426
}
@@ -950,10 +944,10 @@ large_dim!(6, Ix6, (Ix, Ix, Ix, Ix, Ix, Ix), IxDyn, {
950944

951945
impl Ranked for IxDyn
952946
{
953-
type Rank = DDyn;
947+
type NDim = DynRank;
954948

955949
#[inline]
956-
fn rank(&self) -> usize
950+
fn ndim(&self) -> usize
957951
{
958952
self.ix().len()
959953
}

src/dimension/dynindeximpl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::imp_prelude::*;
2+
use crate::layout::ranked::Ranked;
23
#[cfg(not(feature = "std"))]
34
use alloc::boxed::Box;
45
use alloc::vec;

src/dimension/ndindex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::fmt::Debug;
22

33
use super::{stride_offset, stride_offset_checked};
44
use crate::itertools::zip;
5+
use crate::layout::ranked::Ranked;
56
use crate::{Dim, Dimension, IntoDimension, Ix, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, IxDyn, IxDynImpl};
67

78
/// Tuple or fixed size arrays that can be used to index an array.

src/dimension/remove_axis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
use crate::{Axis, Dim, Dimension, Ix, Ix0, Ix1};
9+
use crate::{layout::ranked::Ranked, Axis, Dim, Dimension, Ix, Ix0, Ix1};
1010

1111
/// Array shape with a next smaller dimension.
1212
///

src/indexes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// except according to those terms.
88
use super::Dimension;
99
use crate::dimension::IntoDimension;
10+
use crate::layout::ranked::Ranked;
1011
use crate::split_at::SplitAt;
1112
use crate::zip::Offset;
1213
use crate::Axis;

src/layout/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! flexible and expressive layout representations.
1010
1111
mod bitset;
12-
pub mod dimensionality;
12+
pub mod rank;
1313
pub mod ranked;
1414

1515
#[allow(deprecated)]

0 commit comments

Comments
 (0)