channel

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: Apache-2.0 Imports: 0 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Closed

func Closed[T any](channel <-chan T) bool

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 Limit

func Limit[T any](maximum int, input <-chan T, done chan struct{}) <-chan T

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 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.

func Reverse

func Reverse[T any](input <-chan T) <-chan T

Reverse reads an entire channel into a stack, then writes it back out in reverse order Since it keeps the entire channel in memory, it should not be used for unbounded data sets

func Slice

func Slice[T any](channel <-chan T) []T

Types

This section is empty.

Jump to

Keyboard shortcuts

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