Protocol std::iter::Iterator

protocol Iterator<Self, T> { ... }

Iterators.

See module-level documentation for more details.

Implementing an iterator

Types that have Iterator semantics should implement next at a minimum. When the iterator can cheaply determine the number of remaining elements, it should also implement size_hint. This enables the collections constructed from iterators to efficiently reserve space for the elements and avoid reallocations. If size_hint returns a value, it should be exact.

All types implementing Iterator should also mix in IteratorExt, which provides a number of useful extension methods.

See also DoubleEndedIterator for iterators that can be iterated in reverse order.

Example

Required methods

Provided methods