Codebase list golang-github-vbauerster-mpb / e5cbc73
BarFillerBuilder interface Vladimir Bauer 5 years ago
1 changed file(s) with 12 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
1313 //
1414 // Default implementations can be obtained via:
1515 //
16 // func NewBarFiller(style string) BarFiller
17 // func NewBarFillerRev(style string) BarFiller
18 // func NewBarFillerPick(style string, rev bool) BarFiller
19 // func NewSpinnerFiller(style []string, alignment SpinnerAlignment) BarFiller
16 // func NewBarFiller(BarStyle()) BarFiller
17 // func NewBarFiller(SpinnerStyle()) BarFiller
2018 //
2119 type BarFiller interface {
2220 Fill(w io.Writer, reqWidth int, stat decor.Statistics)
21 }
22
23 // BarFillerBuilder interface.
24 type BarFillerBuilder interface {
25 Build() BarFiller
2326 }
2427
2528 // BarFillerFunc is function type adapter to convert function into BarFiller.
2831 func (f BarFillerFunc) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
2932 f(w, reqWidth, stat)
3033 }
34
35 // NewBarFiller constructs a BarFiller from provided BarFillerBuilder.
36 func NewBarFiller(b BarFillerBuilder) BarFiller {
37 return b.Build()
38 }