-
Notifications
You must be signed in to change notification settings - Fork 333
Add an iter_axis function to get subviews along an axis #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/// the iterator element | ||
/// is a 2 × 2 subview (and there are 3 in total). | ||
/// | ||
/// Iterator element is `ArrayView<A, D::Smaller>` (read-only array view). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should say that it panics if axis
is out of bounds
Thanks. Tests look good enough, it's the same iterator struct. I think we can reuse Can we rename this? |
Sure subviews is a nice name. I'll change that when I'm back on my computer. |
|
So I renamed to |
// ... | ||
let mut a = a.to_owned(); | ||
|
||
for mut subview in a.axis_iter_mut(1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mut subview
; it's sad quirks like this because we have no user-defined DSTs (views should be unsized like slices I think).
Thank you! I'll fixup the panic info; I don't like using headings in module docs (it doesn't work in many ways). |
Add an iter_axis function to get subviews along an axis
This enables for instance iterating along the columns of a matrix.
Right now the test coverage is basic, so I'll probably add more tests before it is mergeable.