github.com/haraldrudell/parl@v0.4.176/sets/set-element-full.go (about)

     1  /*
     2  © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package sets
     7  
     8  // SetElementFull is an value or flag-value item of an enumeration container.
     9  //   - K is the type of a unique key mapping one-to-one to an enumeration value
    10  //   - V is the type of the internally used value representation
    11  type SetElementFull[T comparable] struct {
    12  	ValueV T
    13  	Name   string // key that maps to this enumeration value
    14  	Full   string // sentence describing this flag
    15  }
    16  
    17  func (item *SetElementFull[T]) Description() (desc string) {
    18  	return item.Full
    19  }
    20  
    21  func (item *SetElementFull[T]) Value() (value T) {
    22  	return item.ValueV
    23  }
    24  
    25  func (item *SetElementFull[T]) String() (s string) {
    26  	return item.Name
    27  }