LazyGoal

open class LazyGoal<T>(coroutineContext: CoroutineContext = EmptyCoroutineContext, val dependencies: Collection<Goal<*>> = emptyList(), val block: suspend () -> T) : Goal<T>

Parameters

coroutineContext

additional context information

Constructors

Link copied to clipboard
constructor(coroutineContext: CoroutineContext = EmptyCoroutineContext, dependencies: Collection<Goal<*>> = emptyList(), block: suspend () -> T)

Properties

Link copied to clipboard
val block: suspend () -> T
Link copied to clipboard
override var deferred: Deferred<T>?

Returns current running coroutine if the goal is started. Null if the computation is not started.

Link copied to clipboard
open override val dependencies: Collection<Goal<*>>
Link copied to clipboard

Functions

Link copied to clipboard
open override fun async(coroutineScope: CoroutineScope): Deferred<T>

Get ongoing computation or start a new one. Does not guarantee thread safety. In case of multi-thread access, could create orphan computations. If GoalExecutionRestriction is present in the coroutineScope context, the call could produce a error a warning depending on the settings.

Link copied to clipboard
suspend fun <T> Goal<T>.await(): T
Link copied to clipboard
fun Goal<*>.launch(coroutineScope: CoroutineScope): Job
Link copied to clipboard
open override fun reset()

Reset the computation