Documentation for routine await

Documentation for routine await, assembled from the following types:

class Channel

From Channel

(Channel) sub await

Defined as:

multi sub await(Channel:D)
multi sub await(*@)

Waits until all of one or more channels has a value available, and returns those values (it calls .receive on the channel). Also works with promises.

my $c = Channel.new;
Promise.in(1).then({$c.send(1)});
say await $c;

class Promise

From Promise

(Promise) sub await

multi sub await(Promise:D)
multi sub await(*@)

Waits until one or more promises are all fulfilled, and then returns their values. Also works on channels. Any broken promises will rethrow their exceptions.