Created
January 17, 2017 13:43
-
-
Save VincentMasselis/bec933af5da4f3974cfe05e095c21a6a to your computer and use it in GitHub Desktop.
RxJava2Interop + kotlin extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hu.akarnokd.rxjava.interop.RxJavaInterop | |
// ----------------------------------------------------------------------------------------- | |
// Conversions from 1.x to 2.x | |
// ----------------------------------------------------------------------------------------- | |
fun <T> rx.Observable<T>.toV2Flowable(): io.reactivex.Flowable<T> = RxJavaInterop.toV2Flowable(this) | |
fun <T> rx.Observable<T>.toV2Observable(): io.reactivex.Observable<T> = RxJavaInterop.toV2Observable(this) | |
fun <T> rx.Completable.toV2Maybe(): io.reactivex.Maybe<T> = RxJavaInterop.toV2Maybe(this) | |
fun <T> rx.Single<T>.toV2Maybe(): io.reactivex.Maybe<T> = RxJavaInterop.toV2Maybe(this) | |
fun <T> rx.Single<T>.toV2Single(): io.reactivex.Single<T> = RxJavaInterop.toV2Single(this) | |
fun rx.Completable.toV2Completable(): io.reactivex.Completable = RxJavaInterop.toV2Completable(this) | |
// ----------------------------------------------------------------------------------------- | |
// Conversions from 2.x to 1.x | |
// ----------------------------------------------------------------------------------------- | |
fun <T> org.reactivestreams.Publisher<T>.toV1Observable(): rx.Observable<T> = RxJavaInterop.toV1Observable(this) | |
fun <T> io.reactivex.ObservableSource<T>.toV1Observable(strategy: io.reactivex.BackpressureStrategy): rx.Observable<T> = RxJavaInterop.toV1Observable(this, strategy) | |
fun <T> io.reactivex.SingleSource<T>.toV1Single(): rx.Single<T> = RxJavaInterop.toV1Single(this) | |
fun io.reactivex.CompletableSource.toV1Completable(): rx.Completable = RxJavaInterop.toV1Completable(this) | |
fun <T> io.reactivex.MaybeSource<T>.toV1Single(): rx.Single<T> = RxJavaInterop.toV1Single(this) | |
fun <T> io.reactivex.MaybeSource<T>.toV1Completable(): rx.Completable = RxJavaInterop.toV1Completable(this) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment