Skip to content

Commit

Permalink
more stuff in read me and readme format
Browse files Browse the repository at this point in the history
  • Loading branch information
drshriveer committed Jan 18, 2024
1 parent 0011baa commit fba22ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions genum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ func (c Creatures) NumLegs() int { ... }
func (c Creatures) IsMammal() bool { ... }
```

Genums can also be parsed by their traits by using the `--parsableByTraits=TraitName1,TraitName2` flag. When using this flag code generation will fail if trait values can be parsed into multiple enums; uniqueness is required. Furthermore, there may be edge cases where traits do not parse consistently between various parsers... Durations for example. We will try to fix these in subsequent updates; if you discover any, please file an issue asap.

###### Duplicate Values

Duplicated enum values present a small challenge to code; it is not always possible to distinguish between identical values. For example, when turning an enum into string form. In such cases the generator will consistently choose one value as the "primary" value. To force a primary value, mark all others as `Deprecated:`.
Expand Down Expand Up @@ -127,8 +129,8 @@ Usage of ./bin/genum:
1. Enum definitions must be in a single file.
2. Currently no string transformation support.
3. [Duplicate Values](#duplicate-values) can cause some issues; prefer not to use them.
4. In some cases parsing by traits may have unexpected behaviors. Durations, for example.
4. In some cases parsing by traits may have unexpected behaviors. Durations, for example.
### TODO:
- generate tests for parsing traits to prevent unintentional bugs and to flag issues that may arise
- generate tests for parsing traits to prevent unintentional bugs and to flag issues that may arise

0 comments on commit fba22ea

Please sign in to comment.