All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gfccollective.concurrent.AwaitResult.scala Maven / Gradle / Ivy

The newest version!
package org.gfccollective.concurrent

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Awaitable}


/**
 * Curried version of Scala's Await, for convenience.
 * {{{
 *   AwaitResult(1 second) { futureBasedCall() }
 * }}}
 */
object AwaitResult {

  def apply[T]( atMost: Duration
             )( awaitable: Awaitable[T]
              ): T = {
    Await.result(awaitable, atMost)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy