Adding example of cancelled operator (#29749)
Co-authored-by: Arnout Engelen <github@bzzt.net> Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>
This commit is contained in:
parent
9c200e3a04
commit
432d94d5a4
3 changed files with 40 additions and 2 deletions
|
|
@ -114,6 +114,14 @@ public class SinkDocExamples {
|
|||
// #fold
|
||||
}
|
||||
|
||||
static NotUsed cancelledExample() {
|
||||
// #cancelled
|
||||
Source<Integer, NotUsed> source = Source.range(1, 5);
|
||||
NotUsed sum = source.runWith(Sink.cancelled(), system);
|
||||
return sum;
|
||||
// #cancelled
|
||||
}
|
||||
|
||||
static void headOptionExample() {
|
||||
// #headoption
|
||||
Source<Integer, NotUsed> source = Source.empty();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue