We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 70187f4 commit d0f2dfeCopy full SHA for d0f2dfe
stream.go
@@ -26,8 +26,22 @@ import (
26
func Pipe[T any](ctx context.Context, in <-chan T, out chan<- T) {
27
ctx = _ctx(ctx)
28
29
- // Pipe is just a fan-out of a single channel.
30
- FanOut(ctx, in, out)
+ for {
+ select {
31
+ case <-ctx.Done():
32
+ return
33
+ case v, ok := <-in:
34
+ if !ok {
35
36
+ }
37
+
38
39
40
41
+ case out <- v:
42
43
44
45
}
46
47
type InterceptFunc[T, U any] func(context.Context, T) (U, bool)
0 commit comments