New creates a new segment display. Initially all the segments are off.
(opts ...Option)
| 301 | // New creates a new segment display. |
| 302 | // Initially all the segments are off. |
| 303 | func New(opts ...Option) *Display { |
| 304 | d := &Display{ |
| 305 | segments: map[Segment]bool{}, |
| 306 | } |
| 307 | |
| 308 | for _, opt := range opts { |
| 309 | opt.set(d) |
| 310 | } |
| 311 | return d |
| 312 | } |
| 313 | |
| 314 | // Clear clears the entire display, turning all segments off. |
| 315 | func (d *Display) Clear(opts ...Option) { |