Skip to content

Commit eef102f

Browse files
committed
Change associated type name and simplify large_dim macro
1 parent 3c38785 commit eef102f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/dimension/dimension_trait.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub trait Dimension:
8080

8181
/// The dimensionality of the type, under the new, unstable API.
8282
#[cfg(feature = "unstable")]
83-
type Dimality: Dimensionality;
83+
type Rank: Dimensionality;
8484

8585
/// Returns the number of dimensions (number of axes).
8686
fn ndim(&self) -> usize;
@@ -427,7 +427,7 @@ impl Dimension for Dim<[Ix; 0]>
427427
type Smaller = Self;
428428
type Larger = Ix1;
429429
#[cfg(feature = "unstable")]
430-
type Dimality = D0;
430+
type Rank = D0;
431431
// empty product is 1 -> size is 1
432432
#[inline]
433433
fn ndim(&self) -> usize
@@ -479,7 +479,7 @@ impl Dimension for Dim<[Ix; 1]>
479479
type Smaller = Ix0;
480480
type Larger = Ix2;
481481
#[cfg(feature = "unstable")]
482-
type Dimality = D1;
482+
type Rank = D1;
483483
#[inline]
484484
fn ndim(&self) -> usize
485485
{
@@ -614,7 +614,7 @@ impl Dimension for Dim<[Ix; 2]>
614614
type Smaller = Ix1;
615615
type Larger = Ix3;
616616
#[cfg(feature = "unstable")]
617-
type Dimality = D2;
617+
type Rank = D2;
618618
#[inline]
619619
fn ndim(&self) -> usize
620620
{
@@ -791,7 +791,7 @@ impl Dimension for Dim<[Ix; 3]>
791791
type Smaller = Ix2;
792792
type Larger = Ix4;
793793
#[cfg(feature = "unstable")]
794-
type Dimality = D3;
794+
type Rank = D3;
795795
#[inline]
796796
fn ndim(&self) -> usize
797797
{
@@ -918,14 +918,14 @@ impl Dimension for Dim<[Ix; 3]>
918918
}
919919

920920
macro_rules! large_dim {
921-
($n:expr, $name:ident, $pattern:ty, $larger:ty, $dimality:ty, { $($insert_axis:tt)* }) => (
921+
($n:expr, $name:ident, $pattern:ty, $larger:ty, { $($insert_axis:tt)* }) => (
922922
impl Dimension for Dim<[Ix; $n]> {
923923
const NDIM: Option<usize> = Some($n);
924924
type Pattern = $pattern;
925925
type Smaller = Dim<[Ix; $n - 1]>;
926926
type Larger = $larger;
927927
#[cfg(feature = "unstable")]
928-
type Dimality = $dimality;
928+
type Rank = NDim<$n>;
929929
#[inline]
930930
fn ndim(&self) -> usize { $n }
931931
#[inline]
@@ -951,13 +951,13 @@ macro_rules! large_dim {
951951
);
952952
}
953953

954-
large_dim!(4, Ix4, (Ix, Ix, Ix, Ix), Ix5, D4, {
954+
large_dim!(4, Ix4, (Ix, Ix, Ix, Ix), Ix5, {
955955
impl_insert_axis_array!(4);
956956
});
957-
large_dim!(5, Ix5, (Ix, Ix, Ix, Ix, Ix), Ix6, D5, {
957+
large_dim!(5, Ix5, (Ix, Ix, Ix, Ix, Ix), Ix6, {
958958
impl_insert_axis_array!(5);
959959
});
960-
large_dim!(6, Ix6, (Ix, Ix, Ix, Ix, Ix, Ix), IxDyn, D6, {
960+
large_dim!(6, Ix6, (Ix, Ix, Ix, Ix, Ix, Ix), IxDyn, {
961961
fn insert_axis(&self, axis: Axis) -> Self::Larger {
962962
debug_assert!(axis.index() <= self.ndim());
963963
let mut out = Vec::with_capacity(self.ndim() + 1);
@@ -977,7 +977,7 @@ impl Dimension for IxDyn
977977
type Smaller = Self;
978978
type Larger = Self;
979979
#[cfg(feature = "unstable")]
980-
type Dimality = DDyn;
980+
type Rank = DDyn;
981981
#[inline]
982982
fn ndim(&self) -> usize
983983
{

0 commit comments

Comments
 (0)