enum

package
v0.4.165 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: ISC Imports: 3 Imported by: 0

Documentation

Overview

Package enum provides concrete types to create enumerated collections

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEnumItemImpl

func NewEnumItemImpl[K constraints.Ordered, V any](value V, key K, full string) (item parl.EnumItem[K, V])

NewEnumItemImpl returns a concrete value representing an element of an ordered collection used to implement Integer enumeratiopns and bit-fields

Types

type EnumItemImpl

type EnumItemImpl[K constraints.Ordered, V any] struct {
	ValueV V
	// key that maps to this enumeration value
	KeyK K
	// sentence describing this flag
	Full string
}

EnumItemImpl is an value or flag-value item of an enumeration container.

  • K is the type of a unique key mapping one-to-one to an enumeration value
  • V is the type of the internally used value representation

func (*EnumItemImpl[K, V]) Description

func (item *EnumItemImpl[K, V]) Description() (desc string)

Description returns a descriptive sentence for this enumeration value

func (*EnumItemImpl[K, V]) Key

func (item *EnumItemImpl[K, V]) Key() (key K)

Key returns the key for this enumeration value

func (*EnumItemImpl[K, V]) String

func (item *EnumItemImpl[K, V]) String() (s string)

func (*EnumItemImpl[K, V]) Value

func (item *EnumItemImpl[K, V]) Value() (value V)

Value returns this enumeration value’s value using the restricted type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL