Providing conversion functions between several kind of Asynchronous datatypes.
This project aims to provide easy to use conversion methods from a
representation of asynchronous values in one package to another package,
e.g. RxJava's rx.Observable
to Twitter's com.twitter.util.Future
.
The packages are structured according to the following scheme:
com.github.spockz.async.converters.$sourceLibrary
.
From Scala one can either using implicit conversion or static method calls:
val obj = BigDecimal(5)
val rxObservable = Observable.just(obj)
import Rx2FutureConverters._
val twitterFuture1 = rxObservable.toFuture
// or
val twitterFuture2 =
Rx2FutureConverters.FromSingle.toFuture(rxObservable.toSingle)
From Java
final Observable<Object> observable = Observable.just(5);
final Future<Object> future =
Rx2FutureConverters.fromSingle(observable.toSingle()).toFuture();