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 type is
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 myFuture = Future { 42 }
It can be converted to a domains.task.Task with the help of Return and Await.
import com.thoughtworks.dsl.domains.task._ import com.thoughtworks.dsl.keywords._ val myTask = Task { !Await(myFuture) }
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
An alias to cpsApply.
-
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
- def →[B](y: B): (Await[Value], B)