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

ToSlice

func (input *Channel[T]) ToSlice() <-chan []T

ToSlice puts all values coming from the input channel in a slice.

The resulting slice is sent to the returned channel when all input values have been processed, or the pipeline is canceled.

Example

output := input.ToSlice()