code: public static <R> FuncN<Observable<R>> toAsync(final FuncN<? extends R> func, final Scheduler scheduler) {
          return new FuncN<Observable<R>>() {
              @Override
              public Observable<R> call(final Object... args) {
                  final AsyncSubject<R> subject = AsyncSubject.create();
                  final Worker inner = scheduler.createWorker();
                  inner.schedule(new Action0() {
                      @Override
                      public void call() {
                          R result;
                          try {
                              result = func.call(args);
                          } catch (Throwable t) {
                              subject.onError(t);
                              return;
                          } finally {
                              inner.unsubscribe();
                          }
                          subject.onNext(result);
                          subject.onCompleted();
                      }
                  });
                  return subject;
              }
          };
      }
docs: Convert a synchronous function call into an asynchronous function call through an Observable.
  <p>
  <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
  
  @param <R> the result type
  @param func the function to convert
  @param scheduler the Scheduler used to call the {@code func}
  @return a function that returns an Observable that executes the {@code func} and emits its returned value
  @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>