Async

gears.async.Async
See theAsync companion object
trait Async(using val support: AsyncSupport, val scheduler: support.Scheduler)

The async context: provides the capability to asynchronously await for Sources, and defines a scope for structured concurrency through a CompletionGroup.

As both a context and a capability, the idiomatic way of using Async is to be implicitly passed around functions, as an using parameter:

def function()(using Async): T = ???

It is not recommended to store Async in a class field, since it complicates scoping rules.

Value parameters

scheduler

An implementation of a scheduler, for scheduling computation as they are spawned or resumed. See Scheduler.

support

An implementation of the underlying asynchronous operations (suspend and resume). See AsyncSupport.

Attributes

See also

Async.blocking for a way to construct an Async instance.

Async.group and Future.apply for Async-subscoping operations.

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def await[T](src: Source[T]): T

Waits for completion of source src and returns the result. Suspends the computation.

Waits for completion of source src and returns the result. Suspends the computation.

Attributes

See also

Async.Source.awaitResult and Async$.await for extension methods calling Async!.await from the source itself.

Returns the cancellation group for this Async context.

Returns the cancellation group for this Async context.

Attributes

Returns an Async context of the same kind as this one, with a new cancellation group.

Returns an Async context of the same kind as this one, with a new cancellation group.

Attributes

Givens

Givens

given scheduler: support.Scheduler