Skip to main content
Version: Nightly

peekable

peekable(ref iterable: T) -> _PeekableIterator[T.IteratorType[iterable_is_mut, origin_of(iterable), origin_of(iterable)]]

Returns a peekable iterator that can use the peek method to look ahead at the next element without advancing the iterator.

Args:

  • iterable (T): The iterable to create a peekable iterator from.

Returns:

_PeekableIterator: A peekable iterator.

peekable(var iterable: T) -> _PeekableIterator[T.IteratorOwnedType]

Returns a peekable iterator that can use the peek method to look ahead at the next element without advancing the iterator, consuming the iterable.

Args:

  • iterable (T): The iterable to consume and create a peekable iterator from.

Returns:

_PeekableIterator: A peekable iterator.