ExactSizeIterator spec specifies that
Iterator::size_hint must return
Iterator::size_hintmust return the exact size of the iterator. Note that the size must fit in usize.
However, it also specifies that its own
ExactSizeIterator::len method must also return
I propose that the requirement on
Iterator::size_hint be removed because it:
- Is redundant.
- Imposes a requirement on a method provided by a different trait.
- Makes it impossible to implement an iterator that can quickly give an approximate
size_hintbut can take longer to give an exact