Details

      Description

      Since 1.1 Kotlin supports coroutines. Its library support includes utility functions for converting suspending functions/lambdas to/from CompletableFuture / Deferred. It would be nice to have such support ListenableFuture as well.

      The API could look as follows:

      Unable to find source-code formatter for language: kotlin. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      // a function for creating ListenableFuture from suspending lambda
      fun <T> listenableFuture(context: CoroutineContext = CommonPool, block: suspend () -> T): ListenableFuture<T>
      
      // a function for creating ListenableFuture from Deferred
      fun <T> Deferred<T>.asListenableFuture(): ListenableFuture<T>
      
      // an extension suspending function which awaits for ListenableFuture completion
      suspend fun <T> ListenableFuture<T>.await(): T
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sdeleuze Sébastien Deleuze
                Reporter:
                konrad-kaminski Konrad Kamiński
                Last updater:
                Sébastien Deleuze
              • Votes:
                10 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  13 weeks ago