non blocking SetRefill
Vladimir Bauer
5 years ago
| 131 | 131 | // Given default bar style is "[=>-]<+", refill rune is '+'. |
| 132 | 132 | // To set bar style use mpb.BarStyle(string) BarOption. |
| 133 | 133 | func (b *Bar) SetRefill(amount int64) { |
| 134 | b.operateState <- func(s *bState) { | |
| 134 | select { | |
| 135 | case b.operateState <- func(s *bState) { | |
| 135 | 136 | s.refill = amount |
| 137 | }: | |
| 138 | case <-b.done: | |
| 136 | 139 | } |
| 137 | 140 | } |
| 138 | 141 |