aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
diff options
context:
space:
mode:
authorVsevolod Tolstopyatov <qwwdfsad@gmail.com>2023-03-27 03:01:34 -0700
committerGitHub <noreply@github.com>2023-03-27 13:01:34 +0300
commit9af0b307a14253a21d11d340a78dd9061abee359 (patch)
treecbd2af142d1833b32f657a2eb6b8ed7b6ba0e510 /core/src/main/kotlin/utilities/parallelCollectionOperations.kt
parentb9e9962f75bfd6b19c16eccf7d4d6608b8f5db1e (diff)
downloaddokka-9af0b307a14253a21d11d340a78dd9061abee359.tar.gz
dokka-9af0b307a14253a21d11d340a78dd9061abee359.tar.bz2
dokka-9af0b307a14253a21d11d340a78dd9061abee359.zip
Mark utilities.* API as Dokka-internal (#2937)
* Deprecate unused declaration, remove inline declaration (as it's binary compatible), opt-in into internal API at project level * Opt-in into DokkaInternalApi where applicable * Get rid of intermediate test-utils module
Diffstat (limited to 'core/src/main/kotlin/utilities/parallelCollectionOperations.kt')
-rw-r--r--core/src/main/kotlin/utilities/parallelCollectionOperations.kt4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/src/main/kotlin/utilities/parallelCollectionOperations.kt b/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
index 35ad48fd..d24aa7a6 100644
--- a/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
+++ b/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
@@ -1,15 +1,19 @@
package org.jetbrains.dokka.utilities
import kotlinx.coroutines.*
+import org.jetbrains.dokka.*
+@InternalDokkaApi
suspend inline fun <A, B> Iterable<A>.parallelMap(crossinline f: suspend (A) -> B): List<B> = coroutineScope {
map { async { f(it) } }.awaitAll()
}
+@InternalDokkaApi
suspend inline fun <A, B> Iterable<A>.parallelMapNotNull(crossinline f: suspend (A) -> B?): List<B> = coroutineScope {
map { async { f(it) } }.awaitAll().filterNotNull()
}
+@InternalDokkaApi
suspend inline fun <A> Iterable<A>.parallelForEach(crossinline f: suspend (A) -> Unit): Unit = coroutineScope {
forEach { launch { f(it) } }
}