FanOut

Execute an action concurrently for each item in a slice, preserving input order in the returned slice. Bounded concurrency via semaphore channel. Respects context cancellation for both launch and result collection.

reqs []Reqreq[0]req[1]req[2]req[3]req[4]semaphoremax=3worker 1worker 2worker 3→ waitingresults []order preservedsemaphore channel gates concurrency — result slice indexed by input position

Signature

action contract
func FanOut[Req, Res any](ctx, act *BuiltAction[Req, Res], reqs []Req, maxConcurrency int) []AsyncResult[Res]