cpr

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cpr contains concurrency primitives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Demultiplex

func Demultiplex[T any](inChs ...<-chan T) chan T

Demultiplex demultiplexes the given channels.

func FanIn added in v0.1.2

func FanIn[T any](f func(context.Context, chan<- T) error) (<-chan T, func(context.Context) error)

func ForAll added in v0.0.16

func ForAll[T any](ts []T, f func(T)) func()

func ForEach added in v0.1.2

func ForEach[T any](ctx context.Context, ch <-chan T, f func(T) error) error

func Parallel added in v0.0.16

func Parallel(fs ...func()) func()

func Pop

func Pop[T any](ctx context.Context, ch <-chan T) (T, bool, error)

Pop returns a new T from the ch. It returns a boolean which indicates whether the channel is still open. The error indicates whether the context has been canceled.

func Produce added in v0.1.2

func Produce[T any](f func(context.Context, chan<- T) error) (<-chan T, func(context.Context) error)

func Push

func Push[T any](ctx context.Context, ch chan<- T, ts ...T) error

Push tries to push a T to the ch. The error indicates whether the context has been canceled.

func Seq added in v0.1.2

func Seq[T any](ctx context.Context, ts []T, fs ...func(T) error) ([]T, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL