pipeline: init

This commit is contained in:
2024-02-15 19:31:43 +03:00
parent 562e6633b3
commit 90d14cd743
5 changed files with 109 additions and 0 deletions

14
pipeline/main.go Normal file
View File

@ -0,0 +1,14 @@
package main
func Pipe[In any, Out any](in <-chan In, pipe func(In) Out) <-chan Out {
out := make(chan Out)
go func() {
for n := range in {
out <- pipe(n)
}
close(out)
}()
return out
}