6.10. kink/ENUM_GROUP

6.10.1. type enum_group

An `enum_group` is a generator of a set of enum values.

Example

6.10.1.1. Enum_group.new_member(Name)

`new_member` returns a new enum value of the enum group. `Name` is used as the name of the enum value.

The result enum value provides the following method:

• M1 == M2: returns whether `M1` and `M2` are the same enum value. Precondition: `M1` and `M2` must belong to the same enum group.

Precondition

`Name` must be a `str`.

6.10.1.2. Enum_group.register(Varref)

`register` makes a new enum value using `new_member` method, and sets a constant of the enum value to `Varref`. The symbol of `Varref` is used as the name of the enum value.

Precondition

`Varref` must be a `varref`.

6.10.1.3. Enum_group.name

`name` returns the `str` value of the name of the enum group.

6.10.1.4. Enum_group.all

`all` returns a `vec` of all the enum values of the enum group, in the order that the members were created.

6.10.1.5. Enum_group.have?(Val)

`have?` returns whether `Val` belongs to the enum group.

6.10.2. ENUM_GROUP.new(Name)

`new` makes a new `enum_group`.

`Name` is used as the name of the enum group.

Precondition

`Name` must be a `str`.