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
When implementing an ExactSizeIterator, you must also implement Iterator. When doing so, the implementation of Iterator::size_hint must return the exact size of the iterator.
however the current implementation of Iterator for the ImageBuffer iterators do not have such behaviour and use the default implementation that returns (0, None) even though these iterators do implement std::iter::ExactSizeIterator.
Expected
Every iterator that implements std::iter::ExactSizeIterator should also return the exact size in the size_hint function.
Actual behaviour
Implementations currently return the default (0, None).
Reproduction steps
The following test fails:
let image = RgbImage::from_raw(1,1vec![0; 3]).unwrap();let iter = image.pixels();let exact_len = ExactSizeIterator::len(&iter);assert_eq!(iter.size_hint(), (exact_len, Some(exact_len)));
The text was updated successfully, but these errors were encountered:
The docs for
std::iter::ExactSizeIterator
state thathowever the current implementation of
Iterator
for theImageBuffer
iterators do not have such behaviour and use the default implementation that returns(0, None)
even though these iterators do implementstd::iter::ExactSizeIterator
.Expected
Every iterator that implements
std::iter::ExactSizeIterator
should also return the exact size in thesize_hint
function.Actual behaviour
Implementations currently return the default
(0, None)
.Reproduction steps
The following test fails:
The text was updated successfully, but these errors were encountered: