mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
682 B
682 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ChannelToSeq | channeltoseq | it/channel.go#L39 | it | channel |
|
https://go.dev/play/p/IXqSs2Ooqpm |
|
|
10 |
Builds an iter.Seq from a channel. The returned sequence yields each value received from the channel in order. Iteration blocks until the channel is closed.
Examples:
ch := make(chan int, 3)
ch <- 1; ch <- 2; ch <- 3
close(ch)
seq := it.ChannelToSeq(ch)
var got []int
for v := range seq {
got = append(got, v)
}
// got == []int{1, 2, 3}