Skip to main content Link Search Menu Expand Document (external link)

Buffer

func (input *Channel[T]) Buffer(n int) *Channel[T]

Buffer transparently passes input values to the output channel, but the output channel is buffered. It is useful to avoid backpressure from slow consumers.

Example

output := input.Buffer(2)