Codebase list golang-github-vbauerster-mpb / 1ce85ac
refactoring Wrapper interface Vladimir Bauer 3 years ago
5 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
670670
671671 func extractBaseDecorator(d decor.Decorator) decor.Decorator {
672672 if d, ok := d.(decor.Wrapper); ok {
673 return extractBaseDecorator(d.Base())
673 return extractBaseDecorator(d.Unwrap())
674674 }
675675 return d
676676 }
9292 // it is necessary to implement this interface to retain functionality
9393 // of built-in Decorator.
9494 type Wrapper interface {
95 Base() Decorator
95 Unwrap() Decorator
9696 }
9797
9898 // EwmaDecorator interface.
6262 return d.wc.Sync()
6363 }
6464
65 func (d *mergeDecorator) Base() Decorator {
65 func (d *mergeDecorator) Unwrap() Decorator {
6666 return d.Decorator
6767 }
6868
3434 return d.Decorator.Decor(s)
3535 }
3636
37 func (d *onAbortWrapper) Base() Decorator {
37 func (d *onAbortWrapper) Unwrap() Decorator {
3838 return d.Decorator
3939 }
3333 return d.Decorator.Decor(s)
3434 }
3535
36 func (d *onCompleteWrapper) Base() Decorator {
36 func (d *onCompleteWrapper) Unwrap() Decorator {
3737 return d.Decorator
3838 }