Documentation ¶
Index ¶
- func Beep[T any](in <-chan T) <-chan T
- func Closed[T any](channel <-chan T) bool
- func Filter[T any](input <-chan T, predicate Predicate[T]) <-chan T
- func FromSlice[T any](slice []T) <-chan T
- func Limit[T any](maximum int, input <-chan T, done chan<- struct{}) <-chan T
- func Map[Input any, Output any](input <-chan Input, mapper func(Input) Output) <-chan Output
- func Pipe[T any](input <-chan T, output chan<- T)
- func PipeWithCancel[T any](input <-chan T, output chan<- T, done <-chan struct{})
- func Reverse[T any](input <-chan T) <-chan T
- func Slice[T any](channel <-chan T) []T
- type Done
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Beep ¶ added in v0.19.0
func Beep[T any](in <-chan T) <-chan T
Beep is a simple channel that dumps all of its input to the console. It can be used to debug a channel's contents without disrupting the flow of data.
func Closed ¶
Closed returns TRUE if this channel is closed, and FALSE otherwise. It does not read from the channel, and is just a simple wrapper around a select statement.
func Filter ¶ added in v0.19.1
Filter returns a channel that contains only the items that pass the predicate function.
func FromSlice ¶ added in v0.19.1
func FromSlice[T any](slice []T) <-chan T
FromSlice posts every item from a slice to a channel, and then closes the channel.
func Limit ¶
Limit returns a channel that will receive at most the specified number of items from the input channel. When the maximum is reached, Limit will close the "done" channel, to communicate to other goroutines that they can stop sending items.
func Map ¶ added in v0.19.0
Map applies a mapping function to every value in the input channel, passing the mapped values out to the output channel.
func Pipe ¶
func Pipe[T any](input <-chan T, output chan<- T)
Pipe reads the contents of one channel directly into another channel.
func PipeWithCancel ¶
func PipeWithCancel[T any](input <-chan T, output chan<- T, done <-chan struct{})
PipeWithCancel reads the contents of one channel directly into another channel. If the "done" channel is closed, the pipe will stop.