kotlinx-coroutines-rx2

Utilities for RxJava 2.x.

Coroutine builders:

NameResultScopeDescription
rxCompletableCompletableCoroutineScopeCold completable that starts coroutine on subscribe
rxMaybeMaybeCoroutineScopeCold maybe that starts coroutine on subscribe
rxSingleSingleCoroutineScopeCold single that starts coroutine on subscribe
rxObservableObservableProducerScopeCold observable that starts coroutine on subscribe
rxFlowableFlowableProducerScopeCold observable that starts coroutine on subscribe with backpressure support

Integration with Flow:

NameResultDescription
Flow.asFlowableFlowableConverts the given flow to a cold Flowable.
Flow.asObservableObservableConverts the given flow to a cold Observable.
ObservableSource.asFlowFlowConverts the given cold ObservableSource to flow

Suspending extension functions and suspending iteration:

NameDescription
CompletableSource.awaitAwaits for completion of the completable value
MaybeSource.awaitSingleAwaits for the value of the maybe and returns it or throws an exception
MaybeSource.awaitSingleOrNullAwaits for the value of the maybe and returns it or null
SingleSource.awaitAwaits for completion of the single value and returns it
ObservableSource.awaitFirstAwaits for the first value from the given observable
ObservableSource.awaitFirstOrDefaultAwaits for the first value from the given observable or default
ObservableSource.awaitFirstOrElseAwaits for the first value from the given observable or default from a function
ObservableSource.awaitFirstOrNullAwaits for the first value from the given observable or null
ObservableSource.awaitLastAwaits for the last value from the given observable
ObservableSource.awaitSingleAwaits for the single value from the given observable

Note that Flowable is a subclass of Reactive Streams Publisher and extensions for it are covered by ../kotlinx-coroutines-reactive module.

Conversion functions:

NameDescription
Job.asCompletableConverts job to hot completable
Deferred.asSingleConverts deferred value to hot single
Scheduler.asCoroutineDispatcherConverts scheduler to CoroutineDispatcher

Packages

Link copied to clipboard

Utilities for RxJava 2.x.