spockz / async-converters   0.0.3

GitHub

Providing conversion functions between several kind of Asynchronous datatypes

Scala versions: 2.11 2.10

async-converters

Providing conversion functions between several kind of Asynchronous datatypes.

Join the chat at https://gitter.im/spockz/async-converters Codacy Badge Maven Central Build Status

Features

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.

Structure

The packages are structured according to the following scheme: com.github.spockz.async.converters.$sourceLibrary.

Examples

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();