Async

de.rmgk.delay$.Async
class Async[-Ctx, +A](val handleInCtx: Ctx => Callback[A] => Unit)

A description of a computation that returns an A at some later point in time. This could be seen as a (A => Unit) => Unit but with error handling and an additional context to store some information threaded through the asynchronous execution. You probably do not want to execute this directly

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Sync[Ctx, A]

Members list

Concise view

Value members

Concrete methods

inline def after(inline body: Ctx ?=> Either[Throwable, A] => Unit): Async[Ctx, A]
Extension method from delay

Runs body after the asynchronous computation is finished. Useful for running cleanup handlers.

Runs body after the asynchronous computation is finished. Useful for running cleanup handlers.

Attributes

def bind: A

Access the value inside an Async block.

Access the value inside an Async block.

Attributes

inline def flatMap[B](inline f: A => Async[Ctx, B]): Async[Ctx, B]
Extension method from delay
inline def map[B](inline f: A => B): Async[Ctx, B]
Extension method from delay
inline def run(inline cb: Callback[A])(using inline ctx: Ctx): Unit
Extension method from delay

Start the underlying computation and pass the result to cb.

Start the underlying computation and pass the result to cb.

Attributes

inline def runToAsync(using inline ctx: Ctx): Async[Ctx, A]
Extension method from delay

Start the underlying computation immediately. The result is cached and can be accessed as Async

Start the underlying computation immediately. The result is cached and can be accessed as Async

Attributes

inline def runToFuture(using inline ctx: Ctx): Future[A]
Extension method from delay

Start the underlying computation immediately. Return a Future of the result.

Start the underlying computation immediately. Return a Future of the result.

Attributes

Concrete fields

val handleInCtx: Ctx => Callback[A] => Unit