Codebase list golang-github-vbauerster-mpb / 0dd086c
refactoring: WrapFiller interface Vladimir Bauer 6 years ago
3 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
8080 base mpb.Filler
8181 }
8282
83 // implementing mpb.BaseFiller, so bar.SetRefill works
84 func (cf *customFiller) BaseFiller() mpb.Filler {
83 // implementing mpb.WrapFiller, so bar.SetRefill works
84 func (cf *customFiller) Base() mpb.Filler {
8585 return cf.base
8686 }
8787
2828 f(w, width, stat)
2929 }
3030
31 // Wrapper interface.
31 // WrapFiller interface.
3232 // If you're implementing custom Filler by wrapping a built-in one,
3333 // it is necessary to implement this interface to retain functionality
3434 // of built-in Filler.
35 type Wrapper interface {
35 type WrapFiller interface {
3636 Base() Filler
3737 }
3838
388388 }
389389
390390 func extractBaseFiller(f Filler) Filler {
391 if f, ok := f.(Wrapper); ok {
391 if f, ok := f.(WrapFiller); ok {
392392 return extractBaseFiller(f.Base())
393393 }
394394 return f