is it a proper way to convert Mono to a suspending...
# coroutines
d
is it a proper way to convert Mono to a suspending function?
Copy code
suspend fun <T> Mono<T>.suspend(): T = suspendCancellableCoroutine { coroutine ->
    doOnSuccess {
        coroutine.tryResume(it)
    }

    doOnError {
        coroutine.tryResumeWithException(it)
    }

    doOnCancel {
        coroutine.cancel()
    }
}