Coroutines

Added in 1.0.0-alpha05

public final class Coroutines


Summary

Public methods

static final @NonNull ListenableFuture<@NonNull T>
<T extends Object> toFuture(
    @NonNull Session session,
    @NonNull SuspendFunction1<@NonNull CoroutineScope, @NonNull T> coroutine
)

Converts a coroutine created within the session to a com.google.common.util.concurrent.ListenableFuture.

Public methods

public static final @NonNull ListenableFuture<@NonNull T> <T extends Object> toFuture(
    @NonNull Session session,
    @NonNull SuspendFunction1<@NonNull CoroutineScope, @NonNull T> coroutine
)

Converts a coroutine created within the session to a com.google.common.util.concurrent.ListenableFuture.

The returned com.google.common.util.concurrent.ListenableFuture will be automatically cancelled when the session is destroyed.

Parameters
@NonNull Session session

the androidx.xr.runtime.Session that originated the coroutine.

@NonNull SuspendFunction1<@NonNull CoroutineScope, @NonNull T> coroutine

the coroutine to convert to a com.google.common.util.concurrent.ListenableFuture.