https://kotlinlang.org logo
#arrow
Title
# arrow
p

pakoito

05/17/2019, 8:05 PM
Copy code
fun <A> (suspend () ->A).toObservable(): Observable<A> = Observable.create { emitter ->
  this.startCoroutine(Continuation(EmptyCoroutineContext) { result ->
    result.fold({ a -> emitter.onNext(a); emitter.onComplete() }, emitter::onError)
  })
}