routine done

Documentation for routine done assembled from the following types:

class Supplier

From Supplier

(Supplier) method done

method done(Supplier:D:)

Calls the done callback on all the taps that have one.

my $supplier = Supplier.new;
my $supply   = $supplier.Supply;
$supply.tap(-> $v { say $v }done => { say "no more answers" });
$supplier.emit(42);
$supplier.done;

Will output:

42
no more answers

language documentation Independent routines

From Independent routines

(Independent routines) sub done

Defined as

sub done(--> Nil)

If used outside any supply or react block, throws an exception done without supply or react. Within a Supply block, it will indicate the supply will no longer emit anything. See also documentation on method done.

my $supply = supply {
    for 1 .. 3 {
        emit($_);
    }
    done;
}
$supply.tap-> $v { say "Second : $v" }done => { say "No more" });
# OUTPUT: OUTPUT: «Second : 1␤Second : 2␤Second : 3␤No More␤» 

The block passed to the done named argument will be run when done is called within the supply block.