Package-level declarations

Utilities for RxJava 3.x.

Types

Link copied to clipboard

Implements CoroutineDispatcher on top of an arbitrary Scheduler.

Functions

Link copied to clipboard

Converts this job to the hot reactive completable that signals with onCompleted when the corresponding job completes.

Link copied to clipboard

Converts an instance of Scheduler to an implementation of CoroutineDispatcher and provides native support of delay and withTimeout.

Link copied to clipboard

Transforms given cold ObservableSource into cold Flow.

Link copied to clipboard
fun <T : Any> Flow<T>.asFlowable(context: CoroutineContext = EmptyCoroutineContext): Flowable<T>

Converts the given flow to a cold flowable. The original flow is cancelled when the flowable subscriber is disposed.

Link copied to clipboard
fun <T> Deferred<T?>.asMaybe(context: CoroutineContext): Maybe<T & Any>

Converts this deferred value to the hot reactive maybe that signals onComplete, onSuccess or onError.

Link copied to clipboard
fun <T : Any> Flow<T>.asObservable(context: CoroutineContext = EmptyCoroutineContext): Observable<T>

Converts the given flow to a cold observable. The original flow is cancelled when the observable subscriber is disposed.

Link copied to clipboard

Converts an instance of CoroutineDispatcher to an implementation of Scheduler.

Link copied to clipboard

Converts this deferred value to the hot reactive single that signals either onSuccess or onError.

Link copied to clipboard
suspend fun CompletableSource.await()

Awaits for completion of this completable without blocking the thread. Returns Unit, or throws the corresponding exception if this completable produces an error.

suspend fun <T> SingleSource<T & Any>.await(): T

Awaits for completion of the single value response without blocking the thread. Returns the resulting value, or throws the corresponding exception if this response produces an error.

Link copied to clipboard
suspend fun <T> ObservableSource<T & Any>.awaitFirst(): T

Awaits the first value from the given Observable without blocking the thread and returns the resulting value, or, if the observable has produced an error, throws the corresponding exception.

Link copied to clipboard
suspend fun <T> ObservableSource<T & Any>.awaitFirstOrDefault(default: T): T

Awaits the first value from the given Observable, or returns the default value if none is emitted, without blocking the thread, and returns the resulting value, or, if this observable has produced an error, throws the corresponding exception.

Link copied to clipboard
suspend fun <T> ObservableSource<T & Any>.awaitFirstOrElse(defaultValue: () -> T): T

Awaits the first value from the given Observable, or calls defaultValue to get a value if none is emitted, without blocking the thread, and returns the resulting value, or, if this observable has produced an error, throws the corresponding exception.

Link copied to clipboard
suspend fun <T> ObservableSource<T & Any>.awaitFirstOrNull(): T?

Awaits the first value from the given Observable, or returns null if none is emitted, without blocking the thread, and returns the resulting value, or, if this observable has produced an error, throws the corresponding exception.

Link copied to clipboard
suspend fun <T> ObservableSource<T & Any>.awaitLast(): T

Awaits the last value from the given Observable without blocking the thread and returns the resulting value, or, if this observable has produced an error, throws the corresponding exception.

Link copied to clipboard
suspend fun <T> MaybeSource<T & Any>.awaitSingle(): T

Awaits for completion of the MaybeSource without blocking the thread. Returns the resulting value, or throws if either no value is produced or this MaybeSource produces an error.

suspend fun <T> ObservableSource<T & Any>.awaitSingle(): T

Awaits the single value from the given observable without blocking the thread and returns the resulting value, or, if this observable has produced an error, throws the corresponding exception.

Link copied to clipboard
suspend fun <T> MaybeSource<T & Any>.awaitSingleOrNull(): T?

Awaits for completion of the MaybeSource without blocking the thread. Returns the resulting value, or null if no value is produced, or throws the corresponding exception if this MaybeSource produces an error.

Link copied to clipboard
inline suspend fun <T> MaybeSource<T & Any>.collect(action: (T) -> Unit)

Subscribes to this MaybeSource and performs the specified action for each received element.

inline suspend fun <T> ObservableSource<T & Any>.collect(action: (T) -> Unit)

Subscribes to this ObservableSource and performs the specified action for each received element.

Link copied to clipboard
fun rxCompletable(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> Unit): Completable

Creates cold Completable that runs a given block in a coroutine and emits its result. Every time the returned completable is subscribed, it starts a new coroutine. Unsubscribing cancels running coroutine. Coroutine context can be specified with context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. Method throws IllegalArgumentException if provided context contains a Job instance.

Link copied to clipboard
fun <T : Any> rxFlowable(context: CoroutineContext = EmptyCoroutineContext, block: suspend ProducerScope<T>.() -> Unit): Flowable<T>

Creates cold flowable that will run a given block in a coroutine. Every time the returned flowable is subscribed, it starts a new coroutine.

Link copied to clipboard
fun <T> rxMaybe(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T?): Maybe<T & Any>

Creates cold maybe that will run a given block in a coroutine and emits its result. If block result is null, onComplete is invoked without a value. Every time the returned observable is subscribed, it starts a new coroutine. Unsubscribing cancels running coroutine. Coroutine context can be specified with context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. Method throws IllegalArgumentException if provided context contains a Job instance.

Link copied to clipboard
fun <T : Any> rxObservable(context: CoroutineContext = EmptyCoroutineContext, block: suspend ProducerScope<T>.() -> Unit): Observable<T>

Creates cold observable that will run a given block in a coroutine. Every time the returned observable is subscribed, it starts a new coroutine.

Link copied to clipboard
fun <T : Any> rxSingle(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): Single<T>

Creates cold single that will run a given block in a coroutine and emits its result. Every time the returned observable is subscribed, it starts a new coroutine. Unsubscribing cancels running coroutine. Coroutine context can be specified with context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. Method throws IllegalArgumentException if provided context contains a Job instance.