Skip to content

Commit 2737733

Browse files
committed
Add PromiseStatus enum
minor cleanup Part of #4604
1 parent 9090b1d commit 2737733

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

doc/Type/Promise.rakudoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
=SUBTITLE Status/result of an asynchronous computation
66

7-
my enum PromiseStatus (:Planned(0), :Kept(1), :Broken(2));
87
class Promise {}
98

109
A C<Promise> is used to handle the result of a computation that might not have
@@ -291,8 +290,9 @@ C<Planned>.
291290
method status(Promise:D --> PromiseStatus)
292291

293292
Returns the current state of the promise: C<Kept>, C<Broken> or C<Planned>:
293+
See L<C<PromiseStatus>|/type/PromiseStatus>.
294294

295-
=for code :skip-test<compile time error>
295+
=for code :preamble<my $promise>
296296
say "promise got Kept" if $promise.status ~~ Kept;
297297

298298
=head2 method scheduler

doc/Type/PromiseStatus.rakudoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
=begin pod :kind("Type") :subkind("enum") :category("basic")
2+
3+
=TITLE enum PromiseStatus
4+
5+
=SUBTITLE Indicate status of a promise
6+
7+
enum PromiseStatus <Planned Kept Broken>;
8+
9+
X<|Reference,Planned>
10+
X<|Reference,Kept>
11+
X<|Reference,Broken>
12+
An enum for indicating the result of a L<C<Promise>|/type/Promise>.
13+
Consists of C<Planned>, C<Kept> and C<Broken>.
14+
15+
=end pod

0 commit comments

Comments
 (0)