final case class Await[Value](future: Future[Value]) extends AnyVal with Keyword[Await[Value], Value] with Product with Serializable
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)
- Source
- Await.scala
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)
- Alphabetic
- By Inheritance
- Await
- Serializable
- Serializable
- Product
- Equals
- Keyword
- AnyVal
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##(): Int
- Definition Classes
- Any
- def +(other: String): String
- def ->[B](y: B): (Await[Value], B)
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- final def apply[Domain](handler: (Value) ⇒ Domain)(implicit dsl: Dsl[Await[Value], Domain, Value]): Domain
- Definition Classes
- Keyword
- Annotations
- @inline()
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def cpsApply[Domain](handler: (Value) ⇒ Domain)(implicit dsl: Dsl[Await[Value], Domain, Value]): Domain
- Definition Classes
- Keyword
- Annotations
- @inline()
- def ensuring(cond: (Await[Value]) ⇒ Boolean, msg: ⇒ Any): Await[Value]
- def ensuring(cond: (Await[Value]) ⇒ Boolean): Await[Value]
- def ensuring(cond: Boolean, msg: ⇒ Any): Await[Value]
- def ensuring(cond: Boolean): Await[Value]
- def formatted(fmtstr: String): String
- val future: Future[Value]
- def getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def unary_!: Value
- Definition Classes
- Keyword
- Annotations
- @shift() @compileTimeOnly("This method requires the compiler plugin: `addCompilerPlugin(\"com.thoughtworks.dsl\" %% \"compilerplugins-bangnotation\" % \"latest.release\")` and must only be called inside a code block annotated as `@reset`.")
- def →[B](y: B): (Await[Value], B)