Documentation
¶
Overview ¶
Package cpr contains concurrency primitives.
Index ¶
- func Demultiplex[T any](inChs ...<-chan T) chan T
- func Get[T any](ch <-chan T, errCh <-chan error) (T, bool, error)
- 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 Engine
- 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 Get ¶
Get gets and returns a new T from the supplied channel. It returns a T, a boolean which indicates whether the channel is still open, or an error from the supplied errCh.
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.