Skip to content

Commit f13549a

Browse files
medavoxelizarov
authored andcommitted
In all documentation "get the full code here" (#2076)
1 parent 0e93a38 commit f13549a

9 files changed

+71
-71
lines changed

Diff for: docs/basics.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fun main() {
4141

4242
</div>
4343

44-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-01.kt).
44+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-01.kt).
4545
4646
You will see the following result:
4747

@@ -95,7 +95,7 @@ fun main() {
9595

9696
</div>
9797

98-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-02.kt).
98+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-02.kt).
9999
100100
<!--- TEST
101101
Hello,
@@ -125,7 +125,7 @@ fun main() = runBlocking<Unit> { // start main coroutine
125125

126126
</div>
127127

128-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-03.kt).
128+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-03.kt).
129129
130130
<!--- TEST
131131
Hello,
@@ -180,7 +180,7 @@ fun main() = runBlocking {
180180

181181
</div>
182182

183-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-04.kt).
183+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-04.kt).
184184
185185
<!--- TEST
186186
Hello,
@@ -225,7 +225,7 @@ fun main() = runBlocking { // this: CoroutineScope
225225

226226
</div>
227227

228-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-05.kt).
228+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-05.kt).
229229
230230
<!--- TEST
231231
Hello,
@@ -271,7 +271,7 @@ fun main() = runBlocking { // this: CoroutineScope
271271

272272
</div>
273273

274-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-06.kt).
274+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-06.kt).
275275
276276
<!--- TEST
277277
Task from coroutine scope
@@ -310,7 +310,7 @@ suspend fun doWorld() {
310310

311311
</div>
312312

313-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-07.kt).
313+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-07.kt).
314314
315315
<!--- TEST
316316
Hello,
@@ -347,7 +347,7 @@ fun main() = runBlocking {
347347

348348
</div>
349349

350-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-08.kt).
350+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-08.kt).
351351
352352
<!--- TEST lines.size == 1 && lines[0] == ".".repeat(100_000) -->
353353

@@ -379,7 +379,7 @@ fun main() = runBlocking {
379379

380380
</div>
381381

382-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-09.kt).
382+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-basic-09.kt).
383383
384384
You can run and see that it prints three lines and terminates:
385385

Diff for: docs/cancellation-and-timeouts.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fun main() = runBlocking {
4949

5050
</div>
5151

52-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-01.kt).
52+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-01.kt).
5353
5454
It produces the following output:
5555

@@ -104,7 +104,7 @@ fun main() = runBlocking {
104104

105105
</div>
106106

107-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-02.kt).
107+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-02.kt).
108108
109109
Run it to see that it continues to print "I'm sleeping" even after cancellation
110110
until the job completes by itself after five iterations.
@@ -156,7 +156,7 @@ fun main() = runBlocking {
156156

157157
</div>
158158

159-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-03.kt).
159+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-03.kt).
160160
161161
As you can see, now this loop is cancelled. [isActive] is an extension property
162162
available inside the coroutine via the [CoroutineScope] object.
@@ -203,7 +203,7 @@ fun main() = runBlocking {
203203

204204
</div>
205205

206-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-04.kt).
206+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-04.kt).
207207
208208
Both [join][Job.join] and [cancelAndJoin] wait for all finalization actions to complete,
209209
so the example above produces the following output:
@@ -259,7 +259,7 @@ fun main() = runBlocking {
259259

260260
</div>
261261

262-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-05.kt).
262+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-05.kt).
263263
264264
<!--- TEST
265265
job: I'm sleeping 0 ...
@@ -298,7 +298,7 @@ fun main() = runBlocking {
298298

299299
</div>
300300

301-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-06.kt).
301+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-06.kt).
302302
303303
It produces the following output:
304304

@@ -342,7 +342,7 @@ fun main() = runBlocking {
342342

343343
</div>
344344

345-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-07.kt).
345+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-cancel-07.kt).
346346
347347
There is no longer an exception when running this code:
348348

Diff for: docs/channels.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fun main() = runBlocking {
5252

5353
</div>
5454

55-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-01.kt).
55+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-01.kt).
5656
5757
The output of this code is:
5858

@@ -99,7 +99,7 @@ fun main() = runBlocking {
9999

100100
</div>
101101

102-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-02.kt).
102+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-02.kt).
103103
104104
<!--- TEST
105105
1
@@ -141,7 +141,7 @@ fun main() = runBlocking {
141141

142142
</div>
143143

144-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-03.kt).
144+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-03.kt).
145145
146146
<!--- TEST
147147
1
@@ -214,7 +214,7 @@ fun CoroutineScope.square(numbers: ReceiveChannel<Int>): ReceiveChannel<Int> = p
214214

215215
</div>
216216

217-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt).
217+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt).
218218
219219
<!--- TEST
220220
1
@@ -305,7 +305,7 @@ fun CoroutineScope.filter(numbers: ReceiveChannel<Int>, prime: Int) = produce<In
305305

306306
</div>
307307

308-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt).
308+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt).
309309
310310
The output of this code is:
311311

@@ -408,7 +408,7 @@ fun CoroutineScope.launchProcessor(id: Int, channel: ReceiveChannel<Int>) = laun
408408

409409
</div>
410410

411-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-06.kt).
411+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-06.kt).
412412
413413
The output will be similar to the the following one, albeit the processor ids that receive
414414
each specific integer may be different:
@@ -488,7 +488,7 @@ suspend fun sendString(channel: SendChannel<String>, s: String, time: Long) {
488488

489489
</div>
490490

491-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-07.kt).
491+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-07.kt).
492492
493493
The output is:
494494

@@ -540,7 +540,7 @@ fun main() = runBlocking<Unit> {
540540

541541
</div>
542542

543-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-08.kt).
543+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-08.kt).
544544
545545
It prints "sending" _five_ times using a buffered channel with capacity of _four_:
546546

@@ -595,7 +595,7 @@ suspend fun player(name: String, table: Channel<Ball>) {
595595

596596
</div>
597597

598-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-09.kt).
598+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-09.kt).
599599
600600
The "ping" coroutine is started first, so it is the first one to receive the ball. Even though "ping"
601601
coroutine immediately starts receiving the ball again after sending it back to the table, the ball gets
@@ -658,7 +658,7 @@ fun main() = runBlocking<Unit> {
658658

659659
</div>
660660

661-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-10.kt).
661+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-channel-10.kt).
662662
663663
It prints following lines:
664664

Diff for: docs/composing-suspending-functions.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ suspend fun doSomethingUsefulTwo(): Int {
8181

8282
</div>
8383

84-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-01.kt).
84+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-01.kt).
8585
8686
It produces something like this:
8787

@@ -134,7 +134,7 @@ suspend fun doSomethingUsefulTwo(): Int {
134134

135135
</div>
136136

137-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-02.kt).
137+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-02.kt).
138138
139139
It produces something like this:
140140

@@ -188,7 +188,7 @@ suspend fun doSomethingUsefulTwo(): Int {
188188

189189
</div>
190190

191-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-03.kt).
191+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-03.kt).
192192
193193
It produces something like this:
194194

@@ -285,7 +285,7 @@ suspend fun doSomethingUsefulTwo(): Int {
285285

286286
</div>
287287

288-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-04.kt).
288+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-04.kt).
289289
290290
<!--- TEST ARBITRARY_TIME
291291
The answer is 42
@@ -361,7 +361,7 @@ suspend fun doSomethingUsefulTwo(): Int {
361361

362362
</div>
363363

364-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-05.kt).
364+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-05.kt).
365365
366366
We still have concurrent execution of both operations, as evident from the output of the above `main` function:
367367

@@ -408,7 +408,7 @@ suspend fun failedConcurrentSum(): Int = coroutineScope {
408408

409409
</div>
410410

411-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-06.kt).
411+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-compose-06.kt).
412412
413413
Note how both the first `async` and the awaiting parent are cancelled on failure of one of the children
414414
(namely, `two`):

Diff for: docs/coroutine-context-and-dispatchers.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fun main() = runBlocking<Unit> {
6565

6666
</div>
6767

68-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-01.kt).
68+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-01.kt).
6969
7070
It produces the following output (maybe in different order):
7171

@@ -129,7 +129,7 @@ fun main() = runBlocking<Unit> {
129129

130130
</div>
131131

132-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-02.kt).
132+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-02.kt).
133133
134134
Produces the output:
135135

@@ -186,7 +186,7 @@ fun main() = runBlocking<Unit> {
186186

187187
</div>
188188

189-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-03.kt).
189+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-03.kt).
190190
191191
There are three coroutines. The main coroutine (#1) inside `runBlocking`
192192
and two coroutines computing the deferred values `a` (#2) and `b` (#3).
@@ -238,7 +238,7 @@ fun main() {
238238

239239
</div>
240240

241-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-04.kt).
241+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-04.kt).
242242
243243
It demonstrates several new techniques. One is using [runBlocking] with an explicitly specified context, and
244244
the other one is using the [withContext] function to change the context of a coroutine while still staying in the
@@ -274,7 +274,7 @@ fun main() = runBlocking<Unit> {
274274

275275
</div>
276276

277-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-05.kt).
277+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-05.kt).
278278
279279
In the [debug mode](#debugging-coroutines-and-threads), it outputs something like this:
280280

@@ -332,7 +332,7 @@ fun main() = runBlocking<Unit> {
332332

333333
</div>
334334

335-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-06.kt).
335+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-06.kt).
336336
337337
The output of this code is:
338338

@@ -375,7 +375,7 @@ fun main() = runBlocking<Unit> {
375375

376376
</div>
377377

378-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-07.kt).
378+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-07.kt).
379379
380380
The result is going to be:
381381

@@ -427,7 +427,7 @@ fun main() = runBlocking(CoroutineName("main")) {
427427

428428
</div>
429429

430-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-08.kt).
430+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-08.kt).
431431
432432
The output it produces with `-Dkotlinx.coroutines.debug` JVM option is similar to:
433433

@@ -462,7 +462,7 @@ fun main() = runBlocking<Unit> {
462462

463463
</div>
464464

465-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-09.kt).
465+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-09.kt).
466466
467467
The output of this code with the `-Dkotlinx.coroutines.debug` JVM option is:
468468

@@ -566,7 +566,7 @@ fun main() = runBlocking<Unit> {
566566

567567
</div>
568568

569-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-10.kt).
569+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-10.kt).
570570
571571
The output of this example is:
572572

@@ -620,7 +620,7 @@ fun main() = runBlocking<Unit> {
620620

621621
</div>
622622

623-
> You can get full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-11.kt).
623+
> You can get the full code [here](../kotlinx-coroutines-core/jvm/test/guide/example-context-11.kt).
624624
625625
In this example we launch a new coroutine in a background thread pool using [Dispatchers.Default], so
626626
it works on a different thread from the thread pool, but it still has the value of the thread local variable

0 commit comments

Comments
 (0)