@@ -42,7 +42,11 @@ pub struct Axes<'a, D> {
4242
4343/// Description of the axis, its length and its stride.
4444#[ derive( Debug ) ]
45- pub struct AxisDescription ( pub Axis , pub Ix , pub Ixs ) ;
45+ pub struct AxisDescription {
46+ pub axis : Axis ,
47+ pub len : usize ,
48+ pub stride : isize ,
49+ }
4650
4751copy_and_clone ! ( AxisDescription ) ;
4852
@@ -51,19 +55,22 @@ copy_and_clone!(AxisDescription);
5155#[ allow( clippy:: len_without_is_empty) ]
5256impl AxisDescription {
5357 /// Return axis
58+ #[ deprecated( note = "Use .axis field instead" , since = "0.15.0" ) ]
5459 #[ inline( always) ]
5560 pub fn axis ( self ) -> Axis {
56- self . 0
61+ self . axis
5762 }
5863 /// Return length
64+ #[ deprecated( note = "Use .len field instead" , since = "0.15.0" ) ]
5965 #[ inline( always) ]
6066 pub fn len ( self ) -> Ix {
61- self . 1
67+ self . len
6268 }
6369 /// Return stride
70+ #[ deprecated( note = "Use .stride field instead" , since = "0.15.0" ) ]
6471 #[ inline( always) ]
6572 pub fn stride ( self ) -> Ixs {
66- self . 2
73+ self . stride
6774 }
6875}
6976
@@ -79,11 +86,11 @@ where
7986 fn next ( & mut self ) -> Option < Self :: Item > {
8087 if self . start < self . end {
8188 let i = self . start . post_inc ( ) ;
82- Some ( AxisDescription (
83- Axis ( i) ,
84- self . dim [ i] ,
85- self . strides [ i] as Ixs ,
86- ) )
89+ Some ( AxisDescription {
90+ axis : Axis ( i) ,
91+ len : self . dim [ i] ,
92+ stride : self . strides [ i] as Ixs ,
93+ } )
8794 } else {
8895 None
8996 }
@@ -94,7 +101,11 @@ where
94101 F : FnMut ( B , AxisDescription ) -> B ,
95102 {
96103 ( self . start ..self . end )
97- . map ( move |i| AxisDescription ( Axis ( i) , self . dim [ i] , self . strides [ i] as isize ) )
104+ . map ( move |i| AxisDescription {
105+ axis : Axis ( i) ,
106+ len : self . dim [ i] ,
107+ stride : self . strides [ i] as isize ,
108+ } )
98109 . fold ( init, f)
99110 }
100111
@@ -111,11 +122,11 @@ where
111122 fn next_back ( & mut self ) -> Option < Self :: Item > {
112123 if self . start < self . end {
113124 let i = self . end . pre_dec ( ) ;
114- Some ( AxisDescription (
115- Axis ( i) ,
116- self . dim [ i] ,
117- self . strides [ i] as Ixs ,
118- ) )
125+ Some ( AxisDescription {
126+ axis : Axis ( i) ,
127+ len : self . dim [ i] ,
128+ stride : self . strides [ i] as Ixs ,
129+ } )
119130 } else {
120131 None
121132 }
0 commit comments