fun <T> CoroutineScope.future(
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
block: suspend CoroutineScope.() -> T
Starts new coroutine and returns its result as an implementation of CompletableFuture. The running coroutine is cancelled when the resulting future is cancelled or otherwise completed.
Coroutine context is inherited from a CoroutineScope, additional context elements can be specified with context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. The parent job is inherited from a CoroutineScope as well, but it can also be overridden with corresponding coroutineContext element.
By default, the coroutine is immediately scheduled for execution.
Other options can be specified via
start parameter. See CoroutineStart for details.
A value of CoroutineStart.LAZY is not supported
CompletableFuture framework does not provide the corresponding capability) and
See newCoroutineContext for a description of debugging facilities that are available for newly created coroutine.
context - additional to CoroutineScope.coroutineContext context of the coroutine.
start - coroutine start option. The default value is CoroutineStart.DEFAULT.
block - the coroutine code.