File: any.go

package info (click to toggle)
golang-github-vbauerster-mpb 8.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,044 kB
  • sloc: sh: 7; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 351 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package decor

var _ Decorator = any{}

// Any decorator.
// Converts DecorFunc into Decorator.
//
//	`fn` DecorFunc callback
//	`wcc` optional WC config
func Any(fn DecorFunc, wcc ...WC) Decorator {
	return any{initWC(wcc...), fn}
}

type any struct {
	WC
	fn DecorFunc
}

func (d any) Decor(s Statistics) (string, int) {
	return d.Format(d.fn(s))
}