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
The type IntoIter implemented in #986 is not exposed publicly, which makes it difficult or impossible to implement IntoIterator trait for custom types wrapping ndarray:
use ndarray::iterators::IntoIter;// Module `iterators` is privatepubstructFoo{array:Array1<i32>,}implIntoIteratorforFoo{typeItem = i32;typeIntoIter = IntoIter<i32,Ix1>;// `IntoIter` is privatefninto_iter(self) -> Self::IntoIter{self.array.into_iter()}}
The type is private in it's own module, re-exported publicly from module iterators, however module iterators itself is not public in lib.rs:
I believe that the reason why the author of the PR missed this is the unnecessary spaghetti of re-exports. There seem to be no particular pattern in place. Why is this complexity needed? How it can be improved?
Proposed changes:
expose IntoIter publicly to solve this problem directly
refactor public exports to avoid unnecessary complexity and prevent this kind of bugs from happening again
add tests validating public interface of the library; require these tests to be added along with the new functionality in PRs affecting public interface
The text was updated successfully, but these errors were encountered:
The type
IntoIter
implemented in #986 is not exposed publicly, which makes it difficult or impossible to implementIntoIterator
trait for custom types wrappingndarray
:The type is private in it's own module, re-exported publicly from module
iterators
, however moduleiterators
itself is not public inlib.rs
:ndarray/src/lib.rs
Line 191 in 97ecc0d
The sibling types
Iter
andIterMut
are exposed additionally inlib.rs
ndarray/src/lib.rs
Line 146 in 97ecc0d
I believe that the reason why the author of the PR missed this is the unnecessary spaghetti of re-exports. There seem to be no particular pattern in place. Why is this complexity needed? How it can be improved?
Proposed changes:
IntoIter
publicly to solve this problem directlyThe text was updated successfully, but these errors were encountered: