@@ -10,9 +10,9 @@ use alloc::slice;
1010
1111use crate :: imp_prelude:: * ;
1212
13- use crate :: { Baseiter , ElementsBase , ElementsBaseMut , Iter , IterMut } ;
14-
15- use crate :: iter :: { self , AxisIter , AxisIterMut } ;
13+ use crate :: iter :: { self , Iter , IterMut , AxisIter , AxisIterMut } ;
14+ use crate :: iterators :: base :: { Baseiter , ElementsBase , ElementsBaseMut , OrderOption , PreserveOrder ,
15+ ArbitraryOrder , NoOptimization } ;
1616use crate :: math_cell:: MathCell ;
1717use crate :: IndexLonger ;
1818
@@ -140,14 +140,25 @@ impl<'a, A, D> ArrayView<'a, A, D>
140140where
141141 D : Dimension ,
142142{
143+ /// Create a base iter fromt the view with the given order option
144+ #[ inline]
145+ pub ( crate ) fn into_base_iter < F : OrderOption > ( self ) -> Baseiter < A , D > {
146+ unsafe { Baseiter :: new_with_order :: < F > ( self . ptr . as_ptr ( ) , self . dim , self . strides ) }
147+ }
148+
149+ #[ inline]
150+ pub ( crate ) fn into_elements_base_keep_dims ( self ) -> ElementsBase < ' a , A , D > {
151+ ElementsBase :: new :: < NoOptimization > ( self )
152+ }
153+
143154 #[ inline]
144- pub ( crate ) fn into_base_iter ( self ) -> Baseiter < A , D > {
145- unsafe { Baseiter :: new ( self . ptr . as_ptr ( ) , self . dim , self . strides ) }
155+ pub ( crate ) fn into_elements_base_preserve_order ( self ) -> ElementsBase < ' a , A , D > {
156+ ElementsBase :: new :: < PreserveOrder > ( self )
146157 }
147158
148159 #[ inline]
149- pub ( crate ) fn into_elements_base ( self ) -> ElementsBase < ' a , A , D > {
150- ElementsBase :: new ( self )
160+ pub ( crate ) fn into_elements_base_any_order ( self ) -> ElementsBase < ' a , A , D > {
161+ ElementsBase :: new :: < ArbitraryOrder > ( self )
151162 }
152163
153164 pub ( crate ) fn into_iter_ ( self ) -> Iter < ' a , A , D > {
@@ -179,16 +190,28 @@ where
179190 unsafe { RawArrayViewMut :: new ( self . ptr , self . dim , self . strides ) }
180191 }
181192
193+ /// Create a base iter fromt the view with the given order option
182194 #[ inline]
183- pub ( crate ) fn into_base_iter ( self ) -> Baseiter < A , D > {
184- unsafe { Baseiter :: new ( self . ptr . as_ptr ( ) , self . dim , self . strides ) }
195+ pub ( crate ) fn into_base_iter < F : OrderOption > ( self ) -> Baseiter < A , D > {
196+ unsafe { Baseiter :: new_with_order :: < F > ( self . ptr . as_ptr ( ) , self . dim , self . strides ) }
185197 }
186198
187199 #[ inline]
188- pub ( crate ) fn into_elements_base ( self ) -> ElementsBaseMut < ' a , A , D > {
189- ElementsBaseMut :: new ( self )
200+ pub ( crate ) fn into_elements_base_keep_dims ( self ) -> ElementsBaseMut < ' a , A , D > {
201+ ElementsBaseMut :: new :: < NoOptimization > ( self )
190202 }
191203
204+ #[ inline]
205+ pub ( crate ) fn into_elements_base_preserve_order ( self ) -> ElementsBaseMut < ' a , A , D > {
206+ ElementsBaseMut :: new :: < PreserveOrder > ( self )
207+ }
208+
209+ #[ inline]
210+ pub ( crate ) fn into_elements_base_any_order ( self ) -> ElementsBaseMut < ' a , A , D > {
211+ ElementsBaseMut :: new :: < ArbitraryOrder > ( self )
212+ }
213+
214+
192215 /// Return the array’s data as a slice, if it is contiguous and in standard order.
193216 /// Otherwise return self in the Err branch of the result.
194217 pub ( crate ) fn try_into_slice ( self ) -> Result < & ' a mut [ A ] , Self > {
0 commit comments