Package Usage: go: golang.design/x/chann
Package chann providesa a unified channel package.
The package is compatible with existing buffered and unbuffered
channels. For example, in Go, to create a buffered or unbuffered
channel, one uses built-in function `make` to create a channel:
However, all these channels have a finite capacity for caching, and
it is impossible to create a channel with unlimited capacity, namely,
an unbounded channel.
This package provides the ability to create all possible types of
channels. To create an unbuffered or a buffered channel:
More importantly, when the capacity of the channel is unspecified,
or provided as negative values, the created channel is an unbounded
channel:
Furthermore, all channels provides methods to send (In()),
receive (Out()), and close (Close()).
Note that to close a channel, must use Close() method instead of the
language built-in method
Two additional methods: ApproxLen and Cap returns the current status
of the channel: an approximation of the current length of the channel,
as well as the current capacity of the channel.
See https://golang.design/research/ultimate-channel to understand
the motivation of providing this package and the possible use cases
with this package.
3 versions
Latest release: over 3 years ago
2 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/golang.design/x/chann