In Supplier§
See primary documentation in context for method done
method done(Supplier:)
Calls the done
callback on all the taps that have one.
my = Supplier.new;my = .Supply;.tap(-> , done => );.emit(42);.done;
Will output:
42 no more answers
In Independent routines§
See primary documentation in context for sub done
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.tap( -> , done => );# OUTPUT: «Second : 1Second : 2Second : 3No More»
The block passed to the done
named argument will be run when done
is called within the supply
block.
As of the 2021.06 release of the Rakudo compiler, it is also possibly to supply a value with done
:
sub done( --> Nil)
The specified value will first be emit
ted before an argumentless done
will be called.
my = supply.tap: -> , done =># OUTPUT: OUTPUT: «Val: 1Val: 2Val: 3Val: 42No More»