Versions in this module Expand all Collapse all v0 v0.1.0 Oct 18, 2026 Changes in this version + const DefaultAdaptiveDecreaseFactor + var ErrClosed = errors.New("concurrency: closed") + var ErrInvalidLimit = errors.New("concurrency: invalid limit") + var ErrNilFunction = errors.New("concurrency: nil function") + func ParallelMap[T, R any](ctx context.Context, values []T, limit int, ...) ([]R, error) + type Adaptive struct + func NewAdaptive(options AdaptiveOptions) (*Adaptive, error) + func (a *Adaptive) Acquire(ctx context.Context) (Permit, error) + func (a *Adaptive) InFlight() int + func (a *Adaptive) Limit() int + type AdaptiveOptions struct + DecreaseFactor float64 + IncreaseAfter int + Initial int + Max int + Min int + type Future struct + func Completed[T any](value T) *Future[T] + func Failed[T any](err error) *Future[T] + func Go[T any](ctx context.Context, fn func(context.Context) (T, error)) *Future[T] + func (f *Future[T]) Await(ctx context.Context) (T, error) + func (f *Future[T]) Done() <-chan struct{} + func (f *Future[T]) Try() (value T, err error, ok bool) + type Group struct + func NewGroup(parent context.Context, limit int) (*Group, error) + func (g *Group) Go(fn func(context.Context) error) error + func (g *Group) Wait() error + type Limiter struct + func NewLimiter(rate float64, burst int) (*Limiter, error) + func (l *Limiter) Burst() int + func (l *Limiter) Rate() float64 + func (l *Limiter) SetRate(rate float64) error + func (l *Limiter) TryAcquire(n int) bool + func (l *Limiter) Wait(ctx context.Context, n int) error + type Outcome int + const Failure + const Overload + const Success + type Permit struct + func (p Permit) Release(outcome Outcome) + type Pool struct + func NewPool[I, O any](ctx context.Context, workers, queue int, ...) (*Pool[I, O], error) + func (p *Pool[I, O]) Close() + func (p *Pool[I, O]) Submit(ctx context.Context, input I) (*Future[O], error) + func (p *Pool[I, O]) Wait()