Skip to content

Commit be4cae3

Browse files
committed
Better docs at top level with categorized summary of classes and functions
1 parent caaed5c commit be4cae3

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed

kotlinx-coroutines-core/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Core primitives to work with coroutines.
44

5-
This module provides the following coroutine builders:
5+
Coroutine builder functions:
66

77
| **Name** | **Result** | **Scope** | **Description**
88
| ------------- | ------------- | ---------------- | ---------------
@@ -11,7 +11,7 @@ This module provides the following coroutine builders:
1111
| [produce] | [ProducerJob] | [ProducerScope] | Produces a stream of elements
1212
| [runBlocking] | `T` | [CoroutineScope] | Blocks the thread while the coroutine runs
1313

14-
These builders can be used with the following [coroutine dispatchers][CoroutineDispatcher]:
14+
Coroutine dispatchers implementing [CoroutineDispatcher]:
1515

1616
| **Name** | **Description**
1717
| --------------------------- | ---------------
@@ -28,7 +28,7 @@ Synchronization primitives for coroutines:
2828
| [Mutex] | [lock][Mutex.lock] | Mutual exclusion
2929
| [Channel] | [send][SendChannel.send], [receive][ReceiveChannel.receive] | Communication channel (aka queue or exchanger)
3030

31-
The following _top-level_ suspending functions are provided to be used inside coroutines:
31+
Top-level suspending functions:
3232

3333
| **Name** | **Description**
3434
| ------------- | ---------------

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/Deferred.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ public interface Deferred<out T> : Job {
5757
val isCancelled: Boolean
5858

5959
/**
60-
* Awaits for completion of this value without blocking a thread and resumes when deferred computation is complete.
61-
* This suspending function is cancellable.
60+
* Awaits for completion of this value without blocking a thread and resumes when deferred computation is complete,
61+
* returning the resulting value or throwing the corresponding exception if the deferred had completed exceptionally.
6262
*
63+
* This suspending function is cancellable.
6364
* If the [Job] of the current coroutine is completed while this suspending function is waiting, this function
6465
* immediately resumes with [CancellationException].
6566
*/

kotlinx-coroutines-jdk8/README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,32 @@
22

33
Additional libraries for JDK8 (or Android API level 24).
44

5-
# Package kotlinx.coroutines.experimental.jdk8
5+
Coroutine builders:
66

7-
Additional libraries for JDK8 (or Android API level 24).
7+
| **Name** | **Result** | **Scope** | **Description**
8+
| -------- | ---------- | ---------- | ---------------
9+
| [future] | [CompletableFuture][java.util.concurrent.CompletableFuture] | [CoroutineScope] | Returns a single value with the future result
10+
11+
Extension functions:
12+
13+
| **Name** | **Description**
14+
| -------- | ---------------
15+
| [CompletableFuture.await][java.util.concurrent.CompletableFuture.await] | Awaits for completion of the future
16+
| [Deferred.toCompletableFuture][kotlinx.coroutines.experimental.Deferred.toCompletableFuture] | Converts a deferred value to the future
17+
18+
<!--- SITE_ROOT https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core -->
19+
<!--- DOCS_ROOT kotlinx-coroutines-core/target/dokka/kotlinx-coroutines-core -->
20+
<!--- INDEX kotlinx.coroutines.experimental -->
21+
[CoroutineScope]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-coroutine-scope/index.html
22+
<!--- SITE_ROOT https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8 -->
23+
<!--- DOCS_ROOT kotlinx-coroutines-jdk8/target/dokka/kotlinx-coroutines-jdk8 -->
24+
<!--- INDEX kotlinx.coroutines.experimental.future -->
25+
[java.util.concurrent.CompletableFuture]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/kotlinx.coroutines.experimental.future/java.util.concurrent.-completable-future/index.html
26+
[java.util.concurrent.CompletableFuture.await]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/kotlinx.coroutines.experimental.future/java.util.concurrent.-completable-future/await.html
27+
[kotlinx.coroutines.experimental.Deferred.toCompletableFuture]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/kotlinx.coroutines.experimental.future/kotlinx.coroutines.experimental.-deferred/to-completable-future.html
28+
[future]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/kotlinx.coroutines.experimental.future/future.html
29+
<!--- END -->
30+
31+
# Package kotlinx.coroutines.experimental.future
832

9-
* `future { ... }` coroutine builder that returns `CompletableFuture` and works in `CommonPool` context by default.
10-
* `.await()` suspending function for `CompletableFuture`.
33+
Additional libraries for JDK8 [CompletableFuture][java.util.concurrent.CompletableFuture].

kotlinx-coroutines-jdk8/src/main/kotlin/kotlinx/coroutines/experimental/future/Future.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public fun <T> Deferred<T>.toCompletableFuture(): CompletableFuture<T> {
6262
}
6363

6464
/**
65-
* Awaits for completion of the future without blocking a thread. This suspending function is cancellable.
65+
* Awaits for completion of the future without blocking a thread.
66+
*
67+
* This suspending function is cancellable.
6668
* If the [Job] of the current coroutine is completed while this suspending function is waiting, this function
6769
* immediately resumes with [CancellationException] .
6870
*/

0 commit comments

Comments
 (0)