1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 23:22:28 +08:00

doc: format document

This commit is contained in:
dudaodong
2023-01-13 10:57:40 +08:00
parent b422d98702
commit 5f2c3edff4
3 changed files with 264 additions and 266 deletions

View File

@@ -85,31 +85,31 @@ func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
c := concurrency.NewChannel[int]()
genVals := func() <-chan <-chan int {
out := make(chan (<-chan int))
go func() {
defer close(out)
c := concurrency.NewChannel[int]()
genVals := func() <-chan <-chan int {
out := make(chan (<-chan int))
go func() {
defer close(out)
for i := 1; i <= 5; i++ {
stream := make(chan int, 1)
stream <- i
close(stream)
out <- stream
}
}()
}()
return out
}
}
for v := range c.Bridge(ctx, genVals()) {
fmt.Println(v)
}
for v := range c.Bridge(ctx, genVals()) {
fmt.Println(v)
}
// Output:
// 1
// 2
// 3
// 4
// 5
// Output:
// 1
// 2
// 3
// 4
// 5
}
```