workflow-rx2 / com.squareup.workflow.rx2 / io.reactivex.Observable / asWorker

asWorker

fun <reified T : Any> Observable<out T?>.asWorker(): Worker<T>

Creates a Worker from this Observable.

The Observable will be subscribed to when the Worker is started, and disposed when it is cancelled.

RxJava doesn't allow nulls, but it can't express that in its types. The receiver type parameter is nullable so that the resulting Worker is non-nullable instead of having platform nullability.