Codebase list golang-github-vbauerster-mpb / 52da742
decor Wrapper interface Vladimir Bauer 6 years ago
2 changed file(s) with 16 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
7777 noPop bool
7878 aDecorators []decor.Decorator
7979 pDecorators []decor.Decorator
80 mDecorators []decor.Decorator
8180 amountReceivers []decor.AmountReceiver
8281 shutdownListeners []decor.ShutdownListener
8382 averageAdjusters []decor.AverageAdjuster
195194 for _, decorators := range [...][]decor.Decorator{
196195 s.pDecorators,
197196 s.aDecorators,
198 s.mDecorators,
199197 } {
200198 for _, d := range decorators {
201 cb(d)
199 cb(extractBaseDecorator(d))
202200 }
203201 }
204202 }
461459 Current: s.current,
462460 }
463461 }
462
463 func extractBaseDecorator(d decor.Decorator) decor.Decorator {
464 if d, ok := d.(decor.Wrapper); ok {
465 return extractBaseDecorator(d.Base())
466 }
467 return d
468 }
7171 type Configurator interface {
7272 GetConf() WC
7373 SetConf(*WC)
74 }
75
76 // Wrapper interface.
77 // If you're implementing custom Decorator by wrapping a built-in one,
78 // it is necessary to implement this interface to retain functionality
79 // of built-in Decorator.
80 type Wrapper interface {
81 Base() Decorator
7482 }
7583
7684 // AmountReceiver interface.