Task

com.thoughtworks.dsl.domains.Task$package$.Task$
object Task

Attributes

Authors:

杨博 (Yang Bo)

Source:
Task.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Task.type

Members list

Concise view

Type members

Types

Attributes

Source:
Task.scala

Value members

Concrete methods

inline def apply[A](inline a: A): () => A

Attributes

Source:
Task.scala
def delay[A](f: () => A): () => A

Attributes

Source:
Task.scala
def now[A](a: A): () => A

Attributes

Source:
Task.scala
def onComplete[A](task: () => A)(continue: Try[A] => Unit): Unit

Attributes

Source:
Task.scala
def switchExecutionContext(executionContext: ExecutionContext): () => Unit

Returns a task that does nothing but let the succeeding tasks run on executionContext

Returns a task that does nothing but let the succeeding tasks run on executionContext

Attributes

Example:

All the code after a !switchExecutionContext should be executed on executionContext

         import com.thoughtworks.dsl.macros.Reset.Default.*
         import com.thoughtworks.dsl.domains.Task
         import org.scalatest.Assertion
         import scala.concurrent.ExecutionContext
         import com.thoughtworks.dsl.keywords.Shift
         def myTask: Task[Assertion] = Task {
           val originalThread = Thread.currentThread
           !Shift(Task.switchExecutionContext(ExecutionContext.global))
           Thread.currentThread should not be originalThread
         }
         Task.toFuture(myTask)
Source:
Task.scala
def toFuture[A](task: () => A): Future[A]

Converts a Task to a scala.concurrent.Future.

Converts a Task to a scala.concurrent.Future.

Attributes

See also:

keywords.Await for converting a scala.concurrent.Future to a Task.

Source:
Task.scala