WhenAllVoid
Joins owned no-value tasks without allocating result storage.
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>>, MovableJoins 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>&>, MovableJoins 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, MovableOwns 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.