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 std::iter::Take only implements ExactSizeIterator if its parent iterator implements that. But Take knows how many elements it will return at most, so I think it makes sense if it would always implement ExactSizeIterator.
It would not be correct if the parent iterator produces less items, but this trait is only a best effort to help optimizations, right?
The text was updated successfully, but these errors were encountered:
Take already takes advantage of the given upper bound in size_hint. However, implementing ExactSizeIterator requires the adaptor to know exactly which elements it contains, and not just an estimation.
Currently
std::iter::Take
only implementsExactSizeIterator
if its parent iterator implements that. ButTake
knows how many elements it will return at most, so I think it makes sense if it would always implementExactSizeIterator
.It would not be correct if the parent iterator produces less items, but this trait is only a best effort to help optimizations, right?
The text was updated successfully, but these errors were encountered: