Uh oh!
There was an error while loading. Please reload this page.
Add support for slicing with subviews - #377
Conversation
bluss
commented
Oct 30, 2017
Very nice work! 💟 |
5507f38 to
047e79fComparejturner314
commented
Nov 2, 2017
New changesI just force-pushed two additional changes:
Experiences using this PR, and a potential |
bluss
commented
Nov 3, 2017
Indeed, it seems like a useful type. Note the merge conflict on the PR. I don't mind further rebases and edits on PRs. |
`ndarray` guarantees support for only the latest stable version of Rust, so removing Rust 1.18.0 from continuous integration testing allows us to take advantage of new features.
047e79f to
8413825Comparejturner314
commented
Nov 3, 2017
I rebased the PR off of the latest master and added the |
bluss
commented
Nov 3, 2017
Please derive Copy for it. If we go back to the Range situation, it could have been solved by making it implement IntoIterator, not Iterator. |
34640e3 to
2d4ceabComparejturner314
commented
Nov 3, 2017
Okay, done.
Good point. I guess |
One more change I'm considering is adding field names ( Edit: The third field name will have to be |
bluss
commented
Nov 3, 2017
fields and methods can have the same name, fwiw, but it's good to dwell on the situation. |
jturner314
commented
Nov 3, 2017
Woah, I had no idea. That would be confusing, though. Apparently you call a method with I think I'd like to use field names |
bluss
commented
Nov 4, 2017
that sounds fine |
Also rename .step() to .step_by().
d70e67a to
79659c9Comparebluss
commented
Nov 20, 2017
Thanks a lot for this huge work, for working through it and putting it into such a well disposed form in this PR! 🌟 💯 |
This is a cleaned-up version of PR #369, and it fixes#215. The history is organized into self-contained commits, and each commit passes all tests.
The changes are:
.isubview()to.subview_inplace()..islice()to.slice_inplace().ndarray::simodule tondarray::slicesince theSitype is removed..slice_axis(),.slice_axis_mut(), and.slice_axis_inplace()methods toArrayBase.do_slice()tondarray::dimension, and removeDimension::do_slices()because it's no longer needed.abs_index()from thedimension_traitmodule to thedimensionmodule and change itslenargument to typeIx.NDIM: Option<usize>associated constant toDimensiontrait.zero_index_with_ndim()toDimensiontrait.Siinto an enumSliceOrIndex.Dimension::SliceArgto[SliceOrIndex; n]or[SliceOrIndex].SliceInfothat stores an array/vec/slice ofSliceOrIndexand the dimension type after slicing..slice*()methods to&SliceInfo..slice_move()method.s![]macro to return a&SliceInfo<[SliceOrIndex; n], Do>.Of those, the user-visible changes are 2, 3, 5, 8, and 10. (Technically, 6 and 9 are too, but they're hidden from the docs.) Changes 2, 3, and 10 are breaking changes. (Technically, 6 is too, but
do_slices()was hidden from the docs.)In the future, it would be nice to make slicing more ergonomic in some cases where the user currently has to call
.as_ref()on the&SliceInfoinstance. (Seetest_slice_dyninput_array_fixed,test_slice_dyninput_array_dyn,test_slice_dyninput_vec_fixed, andtest_slice_dyninput_vec_dynintests/array.rs.)