1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-02 20:35:43 +00:00
This commit is contained in:
InsanusMokrassar
2025-09-25 09:15:13 +00:00
parent 2ad9baa9f3
commit babb42c4de
855 changed files with 103566 additions and 35139 deletions

View File

@@ -90,12 +90,12 @@
</div>
</div>
<div id="main">
<div class="main-content" data-page-type="member" id="content" pageids="tgbotapi.core::dev.inmo.tgbotapi.utils//firstOf/kotlinx.coroutines.CoroutineScope#kotlin.Array[kotlin.coroutines.SuspendFunction0[TypeParam(bounds=[kotlin.Any?])]]/PointingToDeclaration//789214110">
<div class="main-content" data-page-type="member" id="content" pageids="tgbotapi.core::dev.inmo.tgbotapi.utils//firstOf/#kotlin.Array[kotlin.coroutines.SuspendFunction0[TypeParam(bounds=[kotlin.Any?])]]/PointingToDeclaration//789214110">
<div class="breadcrumbs"><a href="../index.html">tgbotapi.core</a><span class="delimiter">/</span><a href="index.html">dev.inmo.tgbotapi.utils</a><span class="delimiter">/</span><span class="current">firstOf</span></div>
<div class="cover ">
<h1 class="cover"><span>first</span><wbr><span><span>Of</span></span></h1>
</div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="symbol monospace"><span class="token keyword">suspend </span><span class="token keyword">fun </span><span class="token operator">&lt;</span><a href="first-of.html">T</a><span class="token operator">&gt; </span><span data-unresolved-link="kotlinx.coroutines/CoroutineScope///PointingToDeclaration/">CoroutineScope</span><span class="token punctuation">.</span><a href="first-of.html"><span class="token function">firstOf</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter "><span class="token keyword">vararg </span>deferreds<span class="token operator">: </span><span class="token keyword">suspend </span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="first-of.html">T</a></span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="first-of.html">T</a></div><p class="paragraph">Launches all provided suspending <a href="first-of.html">deferreds</a> in this <span data-unresolved-link="kotlinx.coroutines/CoroutineScope///PointingToDeclaration/">CoroutineScope</span> and returns the value produced by the first block that completes.</p><ul><li><p class="paragraph">Provide at least one block; otherwise the call will never complete.</p></li><li><p class="paragraph">Cancellation and error propagation semantics are delegated to the underlying dev.inmo.micro_utils.coroutines.firstOf implementation.</p></li></ul><span class="kdoc-tag"><h4 class="">Return</h4><p class="paragraph">The result produced by the first completed block.</p></span><h4 class="">Parameters</h4><div class="table"><div class="table-row" data-filterable-current=":tgbotapi.core:dokkaHtmlPartial/commonMain" data-filterable-set=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>T</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The type of the resulting value.</p></div></div></div></div><div class="table-row" data-filterable-current=":tgbotapi.core:dokkaHtmlPartial/commonMain" data-filterable-set=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>deferreds</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The suspending blocks to race; they are started eagerly.</p></div></div></div></div></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="symbol monospace"><span class="token keyword">suspend </span><span class="token keyword">fun </span><span class="token operator">&lt;</span><a href="first-of.html">T</a><span class="token operator">&gt; </span><a href="first-of.html"><span class="token function">firstOf</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter "><span class="token keyword">vararg </span>deferreds<span class="token operator">: </span><span class="token keyword">suspend </span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="first-of.html">T</a></span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="first-of.html">T</a></div><p class="paragraph">Executes the given suspend producers in parallel and returns the first successfully produced value.</p><p class="paragraph">This is a non-nullable variant of <a href="first-of-or-null.html">firstOfOrNull</a>. If no producer yields a value, it throws an <a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html">IllegalStateException</a>.</p><span class="kdoc-tag"><h4 class="">Return</h4><p class="paragraph">the first successfully produced value</p></span><h4 class="">Parameters</h4><div class="table"><div class="table-row" data-filterable-current=":tgbotapi.core:dokkaHtmlPartial/commonMain" data-filterable-set=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>T</span></span></u></div></span></div><div><div class="title"><p class="paragraph">the type of the produced value</p></div></div></div></div><div class="table-row" data-filterable-current=":tgbotapi.core:dokkaHtmlPartial/commonMain" data-filterable-set=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>deferreds</span></span></u></div></span></div><div><div class="title"><p class="paragraph">suspend producers that are started in parallel</p></div></div></div></div></div><h4 class="">Throws</h4><div class="table"><div class="table-row" data-filterable-current=":tgbotapi.core:dokkaHtmlPartial/commonMain" data-filterable-set=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html"><span>Illegal</span><wbr><span>State</span><wbr><span><span>Exception</span></span></a></div></span></div><div><div class="title"><p class="paragraph">if none of the producers yielded a value</p></div></div></div></div><div class="table-row" data-filterable-current=":tgbotapi.core:dokkaHtmlPartial/commonMain" data-filterable-set=":tgbotapi.core:dokkaHtmlPartial/commonMain"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines.cancellation/-cancellation-exception/index.html"><span>Cancellation</span><wbr><span><span>Exception</span></span></a></div></span></div><div><div class="title"><p class="paragraph">if the coroutine scope is cancelled or any producer throws it</p></div></div></div></div></div></div></div>
</div>
<div class="footer">
<a href="#content" id="go-to-top-link" class="footer--button footer--button_go-to-top"></a>