decor doc
Vladimir Bauer
8 years ago
| 0 | // Copyright (C) 2016-2018 Vladimir Bauer | |
| 1 | // Use of this source code is governed by a BSD-style | |
| 2 | // license that can be found in the LICENSE file. | |
| 3 | ||
| 4 | /* | |
| 5 | Package decor contains common decorators for "github.com/vbauerster/mpb" package. | |
| 6 | ||
| 7 | All decorators returned by this package have some closure state. It is ok to use decorators concurrently, | |
| 8 | unless you share the same decorator among multiple *mpb.Bar instances. To avoid data races, create new | |
| 9 | decorator per *mpb.Bar instance. | |
| 10 | ||
| 11 | Don't: | |
| 12 | ||
| 13 | p := mpb.New() | |
| 14 | eta := decor.ETA(0, 0) | |
| 15 | p.AddBar(100, mpb.AppendDecorators(eta)) | |
| 16 | p.AddBar(100, mpb.AppendDecorators(eta)) | |
| 17 | ||
| 18 | Do: | |
| 19 | ||
| 20 | p := mpb.New() | |
| 21 | p.AddBar(100, mpb.AppendDecorators(decor.ETA(0, 0))) | |
| 22 | p.AddBar(100, mpb.AppendDecorators(decor.ETA(0, 0))) | |
| 23 | */ | |
| 24 | package decor |