method iterator

Documentation for method iterator, assembled from the following types:

class Any

From Any

(Any) method iterator

Defined As:

method iterator(--> Iterator)

Treats the Any as 1-item list and uses iterator on it.

my $it = Any.iterator;
say $it.pull-one# OUTPUT: «(Any)␤» 
say $it.pull-one# OUTPUT: «IterationEnd␤» 

role Iterable

From Iterable

(Iterable) method iterator

Defined as:

method iterator(--> Iterator:D)

Method stub that ensures all classes doing the Iterable role have a method iterator.

It is supposed to return an Iterator.

say (1..10).iterator;

role PositionalBindFailover

From PositionalBindFailover

(PositionalBindFailover) method iterator

method iterator(PositionalBindFailover:D:{ ... }

This method stub ensure that a class implementing role PositionalBindFailover provides an iterator method.

class Seq

From Seq

(Seq) method iterator

method iterator(Seq:D: --> Iterator:D)

Returns the underlying iterator, and marks the invocant as consumed. If called on an already consumed sequence, throws an error of type X::Seq::Consumed.