Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Refactor and improve iterators#502

Merged
jturner314 merged 14 commits intorust-ndarray:masterrust-ndarray/ndarray:masterfrom
jturner314:refactor-iteratorsjturner314/ndarray:refactor-iteratorsCopy head branch name to clipboard
Oct 24, 2018
Merged

Refactor and improve iterators#502
jturner314 merged 14 commits intorust-ndarray:masterrust-ndarray/ndarray:masterfrom
jturner314:refactor-iteratorsjturner314/ndarray:refactor-iteratorsCopy head branch name to clipboard

Conversation

@jturner314
Copy link
Member

This PR does the following:

  • Removes lots of iterator constructor functions and replaces them with new methods on the iterators. This is more conventional, easier to understand, and requires fewer imports.

  • Renames OuterIterCore to AxisIterCore to better reflect its purpose.

  • Refactors .split_at() for AxisIter and AxisIterMut to eliminate the axis_iter_split_at_impl! macro.

  • Removes the lifetime from Baseiter and implements iterator traits for Baseiter. This is mostly a conceptual simplification. It will also make it more straightforward to extend the iterators to ArrayPtr/ArrayPtrMut in Add raw array pointer types #496.

  • Improve docs and implement Clone for LanesIter.

The old name was misleading because this struct is designed to iterate
over any axis, not just the outermost axis.
This replaces these free functions with `new` methods on `AxisIter`
and `AxisIterMut`.
Removing the macro makes the code easier to understand without being
much more verbose.
It's simpler to treat `Baseiter` as just an iterator over pointers,
with no lifetime information. Lifetimes should be handled as necessary
by the wrappers around `Baseiter`.
@LukeMathWalker
Copy link
Member

From an API point of view this looks great!

@jturner314 jturner314 merged commit 7df47d2 into rust-ndarray:master Oct 24, 2018
@jturner314 jturner314 deleted the refactor-iterators branch October 24, 2018 02:01
@jturner314
Copy link
Member Author

@LukeMathWalker Thanks for taking a look!

@bluss
Copy link
Member

bluss commented Oct 27, 2018

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.