copy bs.priority to bar.priority
Vladimir Bauer
4 years ago
| 17 | 17 |
// Bar represents a progress bar.
|
| 18 | 18 |
type Bar struct {
|
| 19 | 19 |
index int // used by heap
|
|
20 |
priority int // used by heap
|
| 20 | 21 |
hasEwmaDecorators bool
|
| 21 | 22 |
frameCh chan *frame
|
| 22 | 23 |
operateState chan func(*bState)
|
|
| 32 | 33 |
// bState is actual bar's state.
|
| 33 | 34 |
type bState struct {
|
| 34 | 35 |
id int
|
| 35 | |
priority int // used by heap
|
|
36 |
priority int
|
| 36 | 37 |
reqWidth int
|
| 37 | 38 |
total int64
|
| 38 | 39 |
current int64
|
|
| 86 | 87 |
}
|
| 87 | 88 |
|
| 88 | 89 |
bar := &Bar{
|
|
90 |
priority: bs.priority,
|
| 89 | 91 |
frameCh: make(chan *frame, 1),
|
| 90 | 92 |
operateState: operateState,
|
| 91 | 93 |
done: done,
|
| 5 | 5 |
func (pq priorityQueue) Len() int { return len(pq) }
|
| 6 | 6 |
|
| 7 | 7 |
func (pq priorityQueue) Less(i, j int) bool {
|
| 8 | |
return pq[i].bs.priority < pq[j].bs.priority
|
|
8 |
return pq[i].priority < pq[j].priority
|
| 9 | 9 |
}
|
| 10 | 10 |
|
| 11 | 11 |
func (pq priorityQueue) Swap(i, j int) {
|