Documentation
¶
Index ¶
- func Concat[T any](channels ...<-chan T) <-chan T
- func Drain[T any](channel <-chan T) int
- func DrainOpen[T any](channel <-chan T) int
- func Empty[T any]() <-chan T
- func Filter[T any](source <-chan T, predicate func(T) bool) <-chan T
- func Flatten[T any](source <-chan <-chan T) <-chan T
- func ForEach[T any](source <-chan T, f func(T))
- func FromValues[T any](values ...T) <-chan T
- func Map[T, S any](source <-chan T, f func(T) S, capacity ...int) <-chan S
- func Pop[T any](ctx context.Context, c <-chan T) (T, bool)
- func Push[T any](ctx context.Context, c chan<- T, x T) bool
- func Range[T constraints.Integer](from, to T) <-chan T
- func RangeBig(from, to *big.Int) <-chan *big.Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Concat ¶
func Concat[T any](channels ...<-chan T) <-chan T
Concat produces a channel containing all items from all channels concatenated in the order they are passed.
func Drain ¶
Drain enumerates all items from the channel and discards them. Blocks until the channel is closed and returns number of items drained.
func DrainOpen ¶
DrainOpen enumerates all items from the channel and discards them. Returns number of items drained as soon as channel is empty.
func Filter ¶
Filter returns a new channel that only contains elements that match the predicate. Runs until source channel is closed
func Flatten ¶
func Flatten[T any](source <-chan <-chan T) <-chan T
Flatten flattens a chan of chans into a chan of elements
func ForEach ¶
func ForEach[T any](source <-chan T, f func(T))
ForEach performs the given function on every element in the channel. Runs until source channel is closed
func FromValues ¶
func FromValues[T any](values ...T) <-chan T
FromValues creates a ComposableChannel from a list of values
func Map ¶
Map maps a channel of T to a channel of S. Runs until source channel is closed. By default, output channel has the same capacity as the source channel. Desired capacity of the output channel can be specified via an optional argument.
func Pop ¶
Pop gets the next element from the given channel. Returns false if the context expires before an element is available.
func Push ¶
Push adds the given element to the given channel. Returns false if the context expires before the channel unblocks.
func Range ¶
func Range[T constraints.Integer](from, to T) <-chan T
Range creates a channel that inclusively contains all values from `from` to `to`.
Types ¶
This section is empty.