decor package top godoc update
Vladimir Bauer
8 years ago
| 4 | 4 | /* |
| 5 | 5 | Package decor contains common decorators for "github.com/vbauerster/mpb" package. |
| 6 | 6 | |
| 7 | All decorators returned by this package have some closure state. It is ok to use | |
| 7 | Some decorators returned by this package might have a closure state. It is ok to use | |
| 8 | 8 | decorators concurrently, unless you share the same decorator among multiple |
| 9 | *mpb.Bar instances. To avoid data races, create new decorator per *mpb.Bar | |
| 10 | instance. | |
| 9 | *mpb.Bar instances. To avoid data races, create new decorator per *mpb.Bar instance. | |
| 11 | 10 | |
| 12 | 11 | Don't: |
| 13 | 12 | |
| 14 | 13 | p := mpb.New() |
| 15 | eta := decor.ETA(0, 0) | |
| 14 | eta := decor.ETA(decor.ET_STYLE_GO, 0, startBlock) | |
| 16 | 15 | p.AddBar(100, mpb.AppendDecorators(eta)) |
| 17 | 16 | p.AddBar(100, mpb.AppendDecorators(eta)) |
| 18 | 17 | |
| 19 | 18 | Do: |
| 20 | 19 | |
| 21 | 20 | p := mpb.New() |
| 22 | p.AddBar(100, mpb.AppendDecorators(decor.ETA(0, 0))) | |
| 23 | p.AddBar(100, mpb.AppendDecorators(decor.ETA(0, 0))) | |
| 21 | p.AddBar(100, mpb.AppendDecorators(decor.ETA(decor.ET_STYLE_GO, 0, startBlock))) | |
| 22 | p.AddBar(100, mpb.AppendDecorators(decor.ETA(decor.ET_STYLE_GO, 0, startBlock))) | |
| 24 | 23 | */ |
| 25 | 24 | package decor |