=begin pod

=TITLE class Tap

=SUBTITLE Subscription to a L<Supply>

    class Tap { ... }

A Tap is a subscription to a L<Supply|/type/Supply>.

    my $s   = Supply.new;
    my $tap = $s.tap(
        -> $v { say "the value is $v" },
        done    => { say "Supply is done" },
        closing => { say "Tap closed" },
        quit    => -> $ex { say "Supply finished with error $ex" },
    );

    # later
    $tap.close;
    # or
    $s.close($tap);

=head1 Methods

=head2 method emit

    method emit(Tap:D:) returns Callable:D

Returns the callback that is called for emitted events.

=head2 method done

    method done(Tap:D:)

Returns the callback that is called on successfully shutting down a channel,
if any.

=head2 method quit

    method quit(Tap:D:)

Returns the callback that is called on shutting down a channel with error, if
any.

=head2 method closing

    method closing(Tap:D:)

Returns the callback that is called on closing the tap.

=head2 method supply

    method supply(Tap:D:)

Returns the supply to which the tap belongs.

=head2 method close

    method close(Tap:D:)

Closes the tap.

=end pod
