Skip to main content

Mojo function

iter

iter(var iterable: T) -> T.IteratorOwnedType

Constructs an owned iterator from an iterable.

Args:

  • โ€‹iterable (T): The iterable to construct the iterator from.

Returns:

T.IteratorOwnedType: An owned iterator for the given iterable.

iter[IterableType: Iterable](ref iterable: IterableType) -> IterableType.IteratorType[iterable_is_mut, origin_of(iterable), origin_of(iterable)]

Constructs a borrowed iterator from an iterable.

Parameters:

  • โ€‹IterableType (Iterable): The type of the iterable.

Args:

  • โ€‹iterable (IterableType): The iterable to construct the iterator from.

Returns:

IterableType.IteratorType: A borrowed iterator for the given iterable.

Was this page helpful?