1111//!
1212//! Below, we illustrate how to write functions and traits for most variants of these types.
1313
14- use ndarray:: {
15- ArrayBase ,
16- ArrayRef ,
17- AsLayoutRef ,
18- AsMutLayoutRef ,
19- AsMutRawRef ,
20- AsRawRef ,
21- Data ,
22- DataMut ,
23- Dimension ,
24- LayoutRef ,
25- RawData ,
26- RawDataMut ,
27- RawRef ,
28- } ;
14+ use ndarray:: { ArrayBase , ArrayRef , Data , DataMut , Dimension , LayoutRef , RawData , RawDataMut , RawRef } ;
2915
3016/// Take an array with the most basic requirements.
3117///
@@ -153,19 +139,19 @@ fn takes_rawref_mut<A, D>(arr: &mut RawRef<A, D>)
153139/// Immutable, take a generic that implements `AsRef` to `RawRef`
154140#[ allow( dead_code) ]
155141fn takes_rawref_asref < T , A , D > ( _arr : & T )
156- where T : AsRawRef < A , D > + ?Sized
142+ where T : AsRef < RawRef < A , D > > + ?Sized
157143{
158144 takes_layout ( _arr. as_ref ( ) ) ;
159- takes_layout_asref ( _arr) ;
145+ takes_layout_asref ( _arr. as_ref ( ) ) ;
160146}
161147
162148/// Mutable, take a generic that implements `AsMut` to `RawRef`
163149#[ allow( dead_code) ]
164150fn takes_rawref_asmut < T , A , D > ( _arr : & mut T )
165- where T : AsMutRawRef < A , D > + ?Sized
151+ where T : AsMut < RawRef < A , D > > + ?Sized
166152{
167153 takes_layout_mut ( _arr. as_mut ( ) ) ;
168- takes_layout_asmut ( _arr) ;
154+ takes_layout_asmut ( _arr. as_mut ( ) ) ;
169155}
170156
171157/// Finally, there's `LayoutRef`: this type provides read and write access to an array's *structure*, but not its *data*.
@@ -184,14 +170,14 @@ fn takes_layout_mut<A, D>(_arr: &mut LayoutRef<A, D>) {}
184170/// Immutable, take a generic that implements `AsRef` to `LayoutRef`
185171#[ allow( dead_code) ]
186172fn takes_layout_asref < T , A , D > ( _arr : & T )
187- where T : AsLayoutRef < A , D > + ?Sized
173+ where T : AsRef < LayoutRef < A , D > > + ?Sized
188174{
189175}
190176
191177/// Mutable, take a generic that implements `AsMut` to `LayoutRef`
192178#[ allow( dead_code) ]
193179fn takes_layout_asmut < T , A , D > ( _arr : & mut T )
194- where T : AsMutLayoutRef < A , D > + ?Sized
180+ where T : AsMut < LayoutRef < A , D > > + ?Sized
195181{
196182}
197183
0 commit comments