Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
0.2.0 Preview 1 · Frozen documentation

WhenAllVoid

Joins owned no-value tasks without allocating result storage.

Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →

Module std.task

import std.task;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

WhenAllAsync

pub async fn WhenAllAsync<I>(mut Tasks: I) -> Task<void>
    where I: TypedIterator<Task<void>>, Movable

Joins owned no-value tasks without allocating result storage. I: Structural cursor with exact Task<void> items. Tasks: Owned cursor; borrowed item backing remains live through this task. Return: Completion after first exhaustion and every preceding task completion. Warning: No implicit cancellation or worker-thread blocking. Lazy Next retains its ordinary creation cost; completion cannot authorize dangling item backing.

Example

module example.void_when_all;
from std.task import Task, WhenAllAsync, YieldAsync;
from std.collections import Vector;
async fn WorkAsync() -> Task<void> { await YieldAsync(); }
async fn Main() -> Task<i32> {
    var Empty = Vector<Task<void>>();
    await WhenAllAsync(move(Empty));
    var Tasks = Vector<Task<void>>();
    if Tasks.TryPush(WorkAsync()) is .Err { Error = _ } { return 1; }
    if Tasks.TryPush(WorkAsync()) is .Err { Error = _ } { return 2; }
    await WhenAllAsync(move(Tasks));
    return 0;
}

WhenAllAsync

pub async fn WhenAllAsync<I>(mut Tasks: I) -> Task<void>
    where I: TypedIterator<mut Task<void>&>, Movable

Joins writable borrowed no-value tasks without allocating result storage. I: Structural cursor with exact mut Task<void>& items. Tasks: Owned cursor; borrowed item backing remains live through this task. Return: Completion after first exhaustion and every preceding task completion. Warning: No implicit cancellation or worker-thread blocking. Lazy Next retains its ordinary creation cost; completion cannot authorize dangling item backing.

WhenAllAsync

pub async fn WhenAllAsync<A = DefaultAllocator>(mut Tasks: Vector<Task<void>, A>) -> Task<void>
    where A: Allocator, Defaultable, Movable

Owns a stable no-value task buffer through all delegated joins. A: Owned input allocator. Tasks: Owned already-started no-value tasks. Return: Completion after every input task finishes; empty input completes eagerly.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library