()
| 102 | } |
| 103 | |
| 104 | func ExampleSharedBuffer() { |
| 105 | // never more than 3 elements in the pipeline at once |
| 106 | buf := NewSharedBuffer(3) |
| 107 | |
| 108 | ch1 := buf.NewChannel() |
| 109 | ch2 := buf.NewChannel() |
| 110 | |
| 111 | // or, instead of a straight pipe, implement your pipeline step |
| 112 | Pipe(ch1, ch2) |
| 113 | |
| 114 | // inputs |
| 115 | go func() { |
| 116 | for i := 0; i < 20; i++ { |
| 117 | ch1.In() <- i |
| 118 | } |
| 119 | ch1.Close() |
| 120 | }() |
| 121 | |
| 122 | for _ = range ch2.Out() { |
| 123 | // outputs |
| 124 | } |
| 125 | |
| 126 | buf.Close() |
| 127 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…