Get the next item from the stream, advancing the cursor.
Get the next item from the stream, advancing the cursor.
an Option
containing the next item, or None
if the iterator is exhausted.
Get the count of the number of items consumed so far.
Get the count of the number of items consumed so far.
the count
IteratorStream
places a simple stream on top of an iterator, returningOption
-wrapped instances from the underlying iterator. When the stream is exhausted, theIterator
stream returnsNone
. Differences from a plainIterator
include:- An
IteratorStream
will not throw an exception if you try to read past the end of it. Instead, it will just keep returningNone
.Example of use with a string: