@@ -60,9 +60,10 @@ impl<'a> Reader<'a> {
6060 /// the slice, after singleton dimensions are dropped.
6161 /// Use the multi-dimensional slice macro `s![]` from `ndarray` to conveniently create
6262 /// a multidimensional slice.
63- pub fn read_slice < T , D > ( & self , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < Array < T , D > >
63+ pub fn read_slice < T , S , D > ( & self , slice : & SliceInfo < S , D > ) -> Result < Array < T , D > >
6464 where
6565 T : H5Type ,
66+ S : AsRef < [ SliceOrIndex ] > ,
6667 D : ndarray:: Dimension ,
6768 {
6869 ensure ! ( !self . obj. is_attr( ) , "slicing cannot be used on attribute datasets" ) ;
@@ -160,11 +161,11 @@ impl<'a> Reader<'a> {
160161 }
161162
162163 /// Reads the given `slice` of the dataset into a 1-dimensional array.
163- ///
164- /// The dataset must be 1-dimensional.
165- pub fn read_slice_1d < T > ( & self , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < Array1 < T > >
164+ /// The slice must yield a 1-dimensional result.
165+ pub fn read_slice_1d < T , S > ( & self , slice : & SliceInfo < S , ndarray:: Ix1 > ) -> Result < Array1 < T > >
166166 where
167167 T : H5Type ,
168+ S : AsRef < [ SliceOrIndex ] > ,
168169 {
169170 self . read_slice ( slice)
170171 }
@@ -176,12 +177,13 @@ impl<'a> Reader<'a> {
176177 self . read ( )
177178 }
178179
180+
179181 /// Reads the given `slice` of the dataset into a 2-dimensional array.
180- ///
181- /// The dataset must be 2-dimensional.
182- pub fn read_slice_2d < T > ( & self , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < Array2 < T > >
182+ /// The slice must yield a 2-dimensional result.
183+ pub fn read_slice_2d < T , S > ( & self , slice : & SliceInfo < S , ndarray:: Ix2 > ) -> Result < Array2 < T > >
183184 where
184185 T : H5Type ,
186+ S : AsRef < [ SliceOrIndex ] > ,
185187 {
186188 self . read_slice ( slice)
187189 }
@@ -250,10 +252,11 @@ impl<'a> Writer<'a> {
250252 /// If the array has a fixed number of dimensions, it must match the dimensionality of
251253 /// dataset. Use the multi-dimensional slice macro `s![]` from `ndarray` to conveniently create
252254 /// a multidimensional slice.
253- pub fn write_slice < ' b , A , T , D > ( & self , arr : A , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < ( ) >
255+ pub fn write_slice < ' b , A , T , S , D > ( & self , arr : A , slice : & SliceInfo < S , D > ) -> Result < ( ) >
254256 where
255257 A : Into < ArrayView < ' b , T , D > > ,
256258 T : H5Type ,
259+ S : AsRef < [ SliceOrIndex ] > ,
257260 D : ndarray:: Dimension ,
258261 {
259262 ensure ! ( !self . obj. is_attr( ) , "slicing cannot be used on attribute datasets" ) ;
@@ -494,11 +497,11 @@ impl Container {
494497 }
495498
496499 /// Reads the given `slice` of the dataset into a 1-dimensional array.
497- ///
498- /// The dataset must be 1-dimensional.
499- pub fn read_slice_1d < T > ( & self , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < Array1 < T > >
500+ /// The slice must yield a 1-dimensional result.
501+ pub fn read_slice_1d < T , S > ( & self , slice : & SliceInfo < S , ndarray:: Ix1 > ) -> Result < Array1 < T > >
500502 where
501- T : H5Type
503+ T : H5Type ,
504+ S : AsRef < [ SliceOrIndex ] > ,
502505 {
503506 self . as_reader ( ) . read_slice_1d ( slice)
504507 }
@@ -510,12 +513,12 @@ impl Container {
510513 self . as_reader ( ) . read_2d ( )
511514 }
512515
513- /// Reads the given `slice` of the dataset into a 2-dimensional array.
514- ///
515- /// The dataset must be 2-dimensional.
516- pub fn read_slice_2d < T > ( & self , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < Array2 < T > >
516+ /// Reads the given `slice` of the dataset into a 1-dimensional array.
517+ /// The slice must yield a 2-dimensional result.
518+ pub fn read_slice_2d < T , S > ( & self , slice : & SliceInfo < S , ndarray:: Ix2 > ) -> Result < Array2 < T > >
517519 where
518- T : H5Type
520+ T : H5Type ,
521+ S : AsRef < [ SliceOrIndex ] > ,
519522 {
520523 self . as_reader ( ) . read_slice_2d ( slice)
521524 }
@@ -530,9 +533,10 @@ impl Container {
530533 /// the slice, after singleton dimensions are dropped.
531534 /// Use the multi-dimensional slice macro `s![]` from `ndarray` to conveniently create
532535 /// a multidimensional slice.
533- pub fn read_slice < T , D > ( & self , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < Array < T , D > >
536+ pub fn read_slice < T , S , D > ( & self , slice : & SliceInfo < S , D > ) -> Result < Array < T , D > >
534537 where
535538 T : H5Type ,
539+ S : AsRef < [ SliceOrIndex ] > ,
536540 D : ndarray:: Dimension ,
537541 {
538542 self . as_reader ( ) . read_slice ( slice)
@@ -574,10 +578,11 @@ impl Container {
574578 /// If the array has a fixed number of dimensions, it must match the dimensionality of
575579 /// dataset. Use the multi-dimensional slice macro `s![]` from `ndarray` to conveniently create
576580 /// a multidimensional slice.
577- pub fn write_slice < ' b , A , T , D > ( & self , arr : A , slice : & AsRef < [ SliceOrIndex ] > ) -> Result < ( ) >
581+ pub fn write_slice < ' b , A , T , S , D > ( & self , arr : A , slice : & SliceInfo < S , D > ) -> Result < ( ) >
578582 where
579583 A : Into < ArrayView < ' b , T , D > > ,
580584 T : H5Type ,
585+ S : AsRef < [ SliceOrIndex ] > ,
581586 D : ndarray:: Dimension ,
582587 {
583588 self . as_writer ( ) . write_slice ( arr, slice)
0 commit comments