-
Notifications
You must be signed in to change notification settings - Fork 504
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
Fine-grained selection of where to add type or field attributes using filters #549
base: master
Are you sure you want to change the base?
Conversation
@marjakm this is a great improvement, we've been suffering the lack of this fine-grained functionality for a long time! @danburkert this would nicely solve our problem in #371 . cc @Veetaha |
I don't quite understand why the github actions failed, doesn't seem like related to anything I changed:
|
@LucioFranco any comments? |
any progress? |
@marjakm you will need to rebase against master to get CI working again |
I'll be on vacation for a week starting tomorrow, I'll do it afterwards (just to let you know, I'm still interested in getting this merged). |
This feature would be really handy for adding custom derivations to particular types i.e. strum's variety of derive functions for enums. Can I enquire if there's any progress? |
I think something like this could eventually be merged but I am not sure atm if this is the right approach. |
Squashed commits and rebased onto master |
any updates on this? running into many of the same issues, re: specificity with type/field attributes applied to nested defs |
This does not break the external API, it only adds 2 new functions
and 6 types - 3 pairs of Filter and Selector:
Filters are bitsets (newtypes around u32) and Selectors give meaning to values in that bitset (c-like enums with selected discriminator values). Attribute maps contain these filters and attributes are only applied if all filters match.
This allows very specific selection of where to add attributes, example:
This probably needs some tests, but that would be quite pointless if you don't like this feature - if this seems reasonable, I can add a bunch of tests.
Previous pull request had a similar idea, but implemented it differently:
#494
May solve cases like these:
#371
#332