@@ -33,7 +33,7 @@ impl<A, S: RawData<Elem = A>, D: Dimension> ArrayBase<S, D>
33
33
pub fn get_ptr < I > ( & self , index : I ) -> Option < * const A >
34
34
where I : NdIndex < D >
35
35
{
36
- < Self as AsRef < RawRef < _ , _ > > > :: as_ref ( self ) . get_ptr ( index)
36
+ self . as_raw_ref ( ) . get_ptr ( index)
37
37
}
38
38
39
39
/// Return a raw pointer to the element at `index`, or return `None`
@@ -58,7 +58,7 @@ impl<A, S: RawData<Elem = A>, D: Dimension> ArrayBase<S, D>
58
58
S : RawDataMut < Elem = A > ,
59
59
I : NdIndex < D > ,
60
60
{
61
- < Self as AsMut < RawRef < _ , _ > > > :: as_mut ( self ) . get_mut_ptr ( index)
61
+ self . as_raw_ref_mut ( ) . get_mut_ptr ( index)
62
62
}
63
63
64
64
/// Return a pointer to the first element in the array.
@@ -73,14 +73,14 @@ impl<A, S: RawData<Elem = A>, D: Dimension> ArrayBase<S, D>
73
73
#[ inline( always) ]
74
74
pub fn as_ptr ( & self ) -> * const A
75
75
{
76
- < Self as AsRef < RawRef < _ , _ > > > :: as_ref ( self ) . as_ptr ( )
76
+ self . as_raw_ref ( ) . as_ptr ( )
77
77
}
78
78
79
79
/// Return a raw view of the array.
80
80
#[ inline]
81
81
pub fn raw_view ( & self ) -> RawArrayView < S :: Elem , D >
82
82
{
83
- < Self as AsRef < RawRef < _ , _ > > > :: as_ref ( self ) . raw_view ( )
83
+ self . as_raw_ref ( ) . raw_view ( )
84
84
}
85
85
}
86
86
@@ -111,7 +111,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
111
111
pub fn slice_collapse < I > ( & mut self , info : I )
112
112
where I : SliceArg < D >
113
113
{
114
- self . as_mut ( ) . slice_collapse ( info) ;
114
+ self . as_layout_ref_mut ( ) . slice_collapse ( info) ;
115
115
}
116
116
117
117
/// Slice the array in place along the specified axis.
@@ -121,7 +121,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
121
121
#[ track_caller]
122
122
pub fn slice_axis_inplace ( & mut self , axis : Axis , indices : Slice )
123
123
{
124
- self . as_mut ( ) . slice_axis_inplace ( axis, indices) ;
124
+ self . as_layout_ref_mut ( ) . slice_axis_inplace ( axis, indices) ;
125
125
}
126
126
127
127
/// Slice the array in place, with a closure specifying the slice for each
@@ -135,7 +135,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
135
135
pub fn slice_each_axis_inplace < F > ( & mut self , f : F )
136
136
where F : FnMut ( AxisDescription ) -> Slice
137
137
{
138
- self . as_mut ( ) . slice_each_axis_inplace ( f) ;
138
+ self . as_layout_ref_mut ( ) . slice_each_axis_inplace ( f) ;
139
139
}
140
140
141
141
/// Selects `index` along the axis, collapsing the axis into length one.
@@ -144,7 +144,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
144
144
#[ track_caller]
145
145
pub fn collapse_axis ( & mut self , axis : Axis , index : usize )
146
146
{
147
- self . as_mut ( ) . collapse_axis ( axis, index) ;
147
+ self . as_layout_ref_mut ( ) . collapse_axis ( axis, index) ;
148
148
}
149
149
150
150
/// Return `true` if the array data is laid out in contiguous “C order” in
@@ -154,19 +154,19 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
154
154
/// contiguous in memory, it has custom strides, etc.
155
155
pub fn is_standard_layout ( & self ) -> bool
156
156
{
157
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . is_standard_layout ( )
157
+ self . as_layout_ref ( ) . is_standard_layout ( )
158
158
}
159
159
160
160
/// Return true if the array is known to be contiguous.
161
161
pub ( crate ) fn is_contiguous ( & self ) -> bool
162
162
{
163
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . is_contiguous ( )
163
+ self . as_layout_ref ( ) . is_contiguous ( )
164
164
}
165
165
166
166
/// Return an iterator over the length and stride of each axis.
167
167
pub fn axes ( & self ) -> Axes < ' _ , D >
168
168
{
169
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . axes ( )
169
+ self . as_layout_ref ( ) . axes ( )
170
170
}
171
171
172
172
/*
@@ -180,7 +180,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
180
180
/// preferring axes with len > 1.
181
181
pub fn max_stride_axis ( & self ) -> Axis
182
182
{
183
- LayoutRef :: max_stride_axis ( self . as_ref ( ) )
183
+ self . as_layout_ref ( ) . max_stride_axis ( )
184
184
}
185
185
186
186
/// Reverse the stride of `axis`.
@@ -189,7 +189,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
189
189
#[ track_caller]
190
190
pub fn invert_axis ( & mut self , axis : Axis )
191
191
{
192
- self . as_mut ( ) . invert_axis ( axis) ;
192
+ self . as_layout_ref_mut ( ) . invert_axis ( axis) ;
193
193
}
194
194
195
195
/// Swap axes `ax` and `bx`.
@@ -211,7 +211,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
211
211
#[ track_caller]
212
212
pub fn swap_axes ( & mut self , ax : usize , bx : usize )
213
213
{
214
- self . as_mut ( ) . swap_axes ( ax, bx) ;
214
+ self . as_layout_ref_mut ( ) . swap_axes ( ax, bx) ;
215
215
}
216
216
217
217
/// If possible, merge in the axis `take` to `into`.
@@ -252,13 +252,13 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
252
252
#[ track_caller]
253
253
pub fn merge_axes ( & mut self , take : Axis , into : Axis ) -> bool
254
254
{
255
- self . as_mut ( ) . merge_axes ( take, into)
255
+ self . as_layout_ref_mut ( ) . merge_axes ( take, into)
256
256
}
257
257
258
258
/// Return the total number of elements in the array.
259
259
pub fn len ( & self ) -> usize
260
260
{
261
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . len ( )
261
+ self . as_layout_ref ( ) . len ( )
262
262
}
263
263
264
264
/// Return the length of `axis`.
@@ -270,27 +270,27 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
270
270
#[ track_caller]
271
271
pub fn len_of ( & self , axis : Axis ) -> usize
272
272
{
273
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . len_of ( axis)
273
+ self . as_layout_ref ( ) . len_of ( axis)
274
274
}
275
275
276
276
/// Return whether the array has any elements
277
277
pub fn is_empty ( & self ) -> bool
278
278
{
279
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . is_empty ( )
279
+ self . as_layout_ref ( ) . is_empty ( )
280
280
}
281
281
282
282
/// Return the number of dimensions (axes) in the array
283
283
pub fn ndim ( & self ) -> usize
284
284
{
285
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . ndim ( )
285
+ self . as_layout_ref ( ) . ndim ( )
286
286
}
287
287
288
288
/// Return the shape of the array in its “pattern” form,
289
289
/// an integer in the one-dimensional case, tuple in the n-dimensional cases
290
290
/// and so on.
291
291
pub fn dim ( & self ) -> D :: Pattern
292
292
{
293
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . dim ( )
293
+ self . as_layout_ref ( ) . dim ( )
294
294
}
295
295
296
296
/// Return the shape of the array as it's stored in the array.
@@ -309,7 +309,7 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
309
309
/// ```
310
310
pub fn raw_dim ( & self ) -> D
311
311
{
312
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . raw_dim ( )
312
+ self . as_layout_ref ( ) . raw_dim ( )
313
313
}
314
314
315
315
/// Return the shape of the array as a slice.
@@ -338,13 +338,13 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
338
338
/// ```
339
339
pub fn shape ( & self ) -> & [ usize ]
340
340
{
341
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . shape ( )
341
+ self . as_layout_ref ( ) . shape ( )
342
342
}
343
343
344
344
/// Return the strides of the array as a slice.
345
345
pub fn strides ( & self ) -> & [ isize ]
346
346
{
347
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . strides ( )
347
+ self . as_layout_ref ( ) . strides ( )
348
348
}
349
349
350
350
/// Return the stride of `axis`.
@@ -356,6 +356,6 @@ impl<S: RawData, D: Dimension> ArrayBase<S, D>
356
356
#[ track_caller]
357
357
pub fn stride_of ( & self , axis : Axis ) -> isize
358
358
{
359
- < Self as AsRef < LayoutRef < _ , _ > > > :: as_ref ( self ) . stride_of ( axis)
359
+ self . as_layout_ref ( ) . stride_of ( axis)
360
360
}
361
361
}
0 commit comments