Last active
September 15, 2022 20:48
-
-
Save aleksandarzekovic/d5e327a53106af29b65c65ebc1e0e2e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Resumes the execution of the corresponding coroutine passing [value] as the return value of the last suspension point. | |
*/ | |
@SinceKotlin("1.3") | |
@InlineOnly | |
public inline fun <T> Continuation<T>.resume(value: T): Unit = | |
resumeWith(Result.success(value)) | |
/** | |
* Resumes the execution of the corresponding coroutine so that the [exception] is re-thrown right after the | |
* last suspension point. | |
*/ | |
@SinceKotlin("1.3") | |
@InlineOnly | |
public inline fun <T> Continuation<T>.resumeWithException(exception: Throwable): Unit = | |
resumeWith(Result.failure(exception)) | |
@Suppress("NOTHING_TO_INLINE") | |
internal inline fun Continuation<*>.resumeWithStackTrace(exception: Throwable) { | |
resumeWith(Result.failure(recoverStackTrace(exception, this))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment