bar filler: struct defs on top
Vladimir Bauer
2 years ago
| 38 | 38 | Reverse() BarStyleComposer |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | type component struct { | |
| 42 | width int | |
| 43 | bytes []byte | |
| 44 | } | |
| 45 | ||
| 46 | type flushSection struct { | |
| 47 | meta func(io.Writer, ...interface{}) error | |
| 48 | bytes []byte | |
| 49 | } | |
| 50 | ||
| 41 | 51 | type bFiller struct { |
| 42 | 52 | components [components]component |
| 43 | 53 | meta [components]func(io.Writer, ...interface{}) error |
| 49 | 59 | } |
| 50 | 60 | } |
| 51 | 61 | |
| 52 | type component struct { | |
| 53 | width int | |
| 54 | bytes []byte | |
| 55 | } | |
| 56 | ||
| 57 | 62 | type barStyle struct { |
| 58 | 63 | style [components]string |
| 59 | 64 | metaFuncs [components]func(io.Writer, ...interface{}) error |
| 252 | 257 | return err |
| 253 | 258 | } |
| 254 | 259 | return s.meta[iRbound](w, s.components[iRbound].bytes) |
| 255 | } | |
| 256 | ||
| 257 | type flushSection struct { | |
| 258 | meta func(io.Writer, ...interface{}) error | |
| 259 | bytes []byte | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | func flush(w io.Writer, rev bool, sections ...flushSection) error { |