-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for "name" attribute for enum variants #13
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
- Coverage 76.27% 76.27% -0.01%
==========================================
Files 15 15
Lines 4274 4282 +8
Branches 4274 4282 +8
==========================================
+ Hits 3260 3266 +6
+ Misses 872 871 -1
- Partials 142 145 +3 ☔ View full report in Codecov by Sentry. |
Hi @twop ! I should have the chance to look at this in more detail over the weekend, but on a design note (and sorry if this might add a bit of additional work), what do you think about also adding, for completeness, something like https://serde.rs/container-attrs.html#rename_all That might be an even more elegant way to address your particular case where you want everything in PascalCase! |
I did think about it, but decided not to tackle it in this PR:
That said, it is my preference, and not a belief. |
Upd: added explicit naming for |
As for this, my personal preference likely runs counter to this — I think I'd be frustrated by having that "boilerplate" for every field, but, with that being said, it's not a feature I personally need right now. Ideally we'd also have that "rename all" support (also means more intuitive coming from |
rename all, seems nice, but I haven't looked into it's implementation |
Upd: added support for
name="something"
for child node toofixes #12
done:
attribute
orargument
#[knus(name="PrintString")]
child
), but seems clean enough (skip
is already top level and only applicable for enum variants)name
value if present for code generationderive/tests/normal.rs
derive_decode.md
, but not insideREADME.md
for consistencychild(name="something")
tooso now this works as expected:
and this: