Documentation ¶
Overview ¶
Package cpr contains concurrency primitives.
Index ¶
- func Consume[T any](ctx context.Context, ch <-chan T, f func(T) error) error
- func Demultiplex[T any](inChs ...<-chan T) chan T
- func ForAll[T any](ts []T, f func(T)) func()
- func Parallel(fs ...func()) func()
- func Pop[T any](ctx context.Context, ch <-chan T) (T, bool, error)
- func Push[T any](ctx context.Context, ch chan<- T, ts ...T) error
- func RunTestEngine[T any](ctx context.Context, ps Processor[T], ts ...T) ([]T, error)
- type Collector
- type Pipeline
- type Processor
- type Producer
- type Sink
- type Source
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 Pop ¶
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.
Types ¶
type Collector ¶
type Collector[T any] struct { Result []T }
Collector collects channel result into an array.
Click to show internal directories.
Click to hide internal directories.