pipeline: init
This commit is contained in:
14
pipeline/main.go
Normal file
14
pipeline/main.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user