File tree Expand file tree Collapse file tree 2 files changed +66
-2
lines changed Expand file tree Collapse file tree 2 files changed +66
-2
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ called, indicating an erroneous termination of the supply.
59
59
The C < &closing > callback is called when somebody closes the tap (which
60
60
terminates that subscription, but keeps the supply as a whole in tact).
61
61
62
- Method C < tap > returns an object of type C < Tap > , on which you can call the
63
- C < close > method to cancle the subscription.
62
+ Method C < tap > returns an object of type L < Tap|/type/Tap > , on which you can
63
+ call the C < close > method to cancle the subscription.
64
64
65
65
= head2 method emit
66
66
Original file line number Diff line number Diff line change
1
+ = begin pod
2
+
3
+ = TITLE class Tap
4
+
5
+ = SUBTITLE A subscription to a supply
6
+
7
+ class Tap { ... }
8
+
9
+ A Tap is a subscription to a L < Supply|/type/Supply > .
10
+
11
+ my $s = Supply.new;
12
+ my $tap = $s.tap(
13
+ -> $v { say "the value is $v" },
14
+ done => { say "Supply is done" },
15
+ closing => { say "Tap closed" },
16
+ quit => -> $ex { say "Supply finished with error $ex" },
17
+ );
18
+
19
+ # later
20
+ $tap.close;
21
+ # or
22
+ $s.close($tap);
23
+
24
+ = head1 Methods
25
+
26
+ = head2 method emit
27
+
28
+ method emit(Tap:D:) returns Callable:D
29
+
30
+ Returns the callback that is called for emitted events.
31
+
32
+ = head2 method done
33
+
34
+ method done(Tap:D:)
35
+
36
+ Returns the callback that is called on successfully shutting down a channel,
37
+ if any.
38
+
39
+ = head2 method quit
40
+
41
+ method quit(Tap:D:)
42
+
43
+ Returns the callback that is called on shutting down a channel with error, if
44
+ any.
45
+
46
+ = head2 method closing
47
+
48
+ method closing(Tap:D:)
49
+
50
+ Returns the callback that is called on closing the tap.
51
+
52
+ = head2 method supply
53
+
54
+ method supply(Tap:D:)
55
+
56
+ Returns the supply to which the tap belongs.
57
+
58
+ = head2 method close
59
+
60
+ method closing(Tap:D:)
61
+
62
+ Closes the tap.
63
+
64
+ = end pod
You can’t perform that action at this time.
0 commit comments