jsonutils: add customization for toJson via ToJsonOptions; generalize symbolName; add symbolRank (#18029)
* jsonutils: add customization for toJson via `ToJsonOptions` * add enumutils.symbolRank * lookup table implementation for HoleyEnum * cleanup * changelog * fixup * Update lib/std/jsonutils.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
parent
6e0fe965da
commit
7f077a76fe
4 changed files with 112 additions and 14 deletions
|
|
@ -118,9 +118,11 @@
|
|||
- `json.%`,`json.to`, `jsonutils.formJson`,`jsonutils.toJson` now work with `uint|uint64`
|
||||
instead of raising (as in 1.4) or giving wrong results (as in 1.2).
|
||||
|
||||
- `jsonutils` now handles `cstring` (including as Table key), and `set`.
|
||||
|
||||
- added `jsonutils.jsonTo` overload with `opt = Joptions()` param.
|
||||
|
||||
- `jsonutils` now handles `cstring` (including as Table key), and `set`.
|
||||
- `jsonutils.toJson` now supports customization via `ToJsonOptions`.
|
||||
|
||||
- Added an overload for the `collect` macro that inferes the container type based
|
||||
on the syntax of the last expression. Works with std seqs, tables and sets.
|
||||
|
|
@ -138,6 +140,7 @@
|
|||
- Added `std/enumutils` module. Added `genEnumCaseStmt` macro that generates case statement to parse string to enum.
|
||||
Added `items` for enums with holes.
|
||||
Added `symbolName` to return the enum symbol name ignoring the human readable name.
|
||||
Added `symbolRank` to return the index in which an enum member is listed in an enum.
|
||||
|
||||
- Added `typetraits.HoleyEnum` for enums with holes, `OrdinalEnum` for enums without holes.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue