com.thoughtworks.dsl.keywords
Await is a Keyword to extract value from a scala.concurrent.Future.
This keyword is available in functions whose return types are Future, domains.task.Task, or any exception aware continuations as (_ !! Throwable !! _).
(_ !! Throwable !! _)
杨博 (Yang Bo)
Given a Future:
import scala.concurrent.Future val myFuture40 = Future { 40 }
It can be Await in another Future
import scala.concurrent.Future def myFuture42 = Future { !Await(myFuture40) + 2 }
It can be converted to a domains.task.Task with the help of Await.
import com.thoughtworks.dsl.domains.task._ import com.thoughtworks.dsl.keywords._ val myTask = Task { !Await(myFuture42) }
Then a domains.task.Task can be converted back to a scala.concurrent.Future via domains.task.Task.toFuture.
val myAssertionTask = Task { !Shift(myTask) should be(42) } Task.toFuture(myAssertionTask)
An alias to cpsApply.
Await is a Keyword to extract value from a scala.concurrent.Future.
This keyword is available in functions whose return types are Future, domains.task.Task, or any exception aware continuations as
(_ !! Throwable !! _)
.Author:
杨博 (Yang Bo)
Given a Future:
It can be Await in another Future
It can be converted to a domains.task.Task with the help of Await.
Then a domains.task.Task can be converted back to a scala.concurrent.Future via domains.task.Task.toFuture.