You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, ArrayView has a helpful lifetime-preserving methods like to_slice, but no way to preserve lifetimes of iterators like axis_iter, outer_iter and such.
This makes it difficult to return iterables from helper functions like this:
fnlazy_process(&self) -> impl'_ + Serialize{IterSerialize(self.data.outer_iter().map(move |column| {IterSerialize(column.outer_iter().map(|pixel| pixel.to_slice().unwrap()))// <-- cannot return value referencing function parameter `column`}))}
I suggest there should be overrides like into_outer_iter, into_axis_iter etc. on ArrayView that would return iterators tied by the lifetime to the original data instead of the ArrayView itself.
Note: while looking for open issues, the only relevant I found was #320, but there the author could afford to just reshape / flatten the data; that might not always be possible, like in my example above. @bluss mentioned issues and suggestions similar to what I'm describing here though: #320 (comment)
The text was updated successfully, but these errors were encountered:
You're not gonna believe this... there is an into_axis_iter on the ArrayView types! It got listed as doc(hidden) in 2016 (6d33685) and shortly after as deprecated (5d98d80); I'm frankly not sure why. I'm happy to un-deprecate it and add the other .into_*_iter methods.
Currently,
ArrayView
has a helpful lifetime-preserving methods liketo_slice
, but no way to preserve lifetimes of iterators likeaxis_iter
,outer_iter
and such.This makes it difficult to return iterables from helper functions like this:
I suggest there should be overrides like
into_outer_iter
,into_axis_iter
etc. onArrayView
that would return iterators tied by the lifetime to the original data instead of theArrayView
itself.Note: while looking for open issues, the only relevant I found was #320, but there the author could afford to just reshape / flatten the data; that might not always be possible, like in my example above. @bluss mentioned issues and suggestions similar to what I'm describing here though: #320 (comment)
The text was updated successfully, but these errors were encountered: