-
Notifications
You must be signed in to change notification settings - Fork 123
/
bar_filler.go
31 lines (25 loc) · 667 Bytes
/
bar_filler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package mpb
import (
"io"
"github.com/vbauerster/mpb/v8/decor"
)
// BarFiller interface.
// Bar (without decorators) renders itself by calling BarFiller's Fill method.
type BarFiller interface {
Fill(io.Writer, decor.Statistics) error
}
// BarFillerBuilder interface.
// Default implementations are:
//
// BarStyle()
// SpinnerStyle()
// NopStyle()
type BarFillerBuilder interface {
Build() BarFiller
}
// BarFillerFunc is function type adapter to convert compatible function
// into BarFiller interface.
type BarFillerFunc func(io.Writer, decor.Statistics) error
func (f BarFillerFunc) Fill(w io.Writer, stat decor.Statistics) error {
return f(w, stat)
}