Fut

value class Loop

The Loop class houses static methods for creating asynchronous loops.

Loop is in the Prelude, meaning it is always available and does not need to be imported.

API Reference

Static Methods

parFor(i0: int, iN: int, body: (int) -> Fut<void>) -> Fut<void>

Executes body in parallel for each index in the range [i0, iN). Returns a new Fut<void> that will be completed when all body tasks are completed. If any iteration fails, the returned Fut fails as soon as it does, but the other iterations still run.


marchingFor(i0: int, iN: int, body: (int) -> Fut<void>) -> Fut<void>

Asynchronously executes body for each index in the range [i0, iN), one at a time. Each iteration waits for the previous iteration to complete before executing. Returns a new Fut<void> that will be completed when all body tasks are completed. If an iteration fails, no further iterations run, and the returned Fut fails.