Reference
std/async
std/async
Task handles of async functions: wait for all, the first, or cancel.
narra
import * as Async from "std/async"
The guide teaches it in chapter 14, Async.
This page is generated by scripts/std/generate.nra from narrac query --json interface std/async. Do not edit it.
Types
AsyncError
narra
export enum AsyncError {
Cancelled
Failed(message: string)
}
Functions
detach
narra
export function detach<T>(_handle: Async<T>)
Effects: none.
idle
narra
export function idle(): Async<void> uses alloc
Effects: alloc.
then
narra
export function then<T, effect E>(handle: Async<T>, escaping callback: (T) => void uses E) uses E, alloc
Effects: E, alloc.
peek
narra
export function peek<T>(handle: Async<T>): Option<T> uses alloc
Effects: alloc.
cancel
narra
export function cancel<T>(handle: Async<T>)
Effects: none.
next
narra
export function next<T, effect E>(stream: AsyncGenerator<T> uses E): Async<Option<T>> uses E, alloc
Effects: E, alloc.
all
narra
export function all<T>(handles: Array<Async<T>>): Async<Array<T>> from handles uses alloc
Effects: alloc.
race
narra
export function race<T>(handles: Array<Async<T>>): Async<Option<T>> from handles uses alloc
Effects: alloc.