Skip to content
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

Extend --with-attribute-custom to support more types #2978

Open
jschwe opened this issue Nov 13, 2024 · 2 comments
Open

Extend --with-attribute-custom to support more types #2978

jschwe opened this issue Nov 13, 2024 · 2 comments

Comments

@jschwe
Copy link
Contributor

jschwe commented Nov 13, 2024

I would like to use custom attributes to feature guard bindings based on information in the doc comment.

E.g. if the doc comment contains @since 10, I would like to generate

#[cfg(feature = "api-10")]
<the item>

Currently, add_attributes seems to only support structs, enums and unions. I would like to also have support for functions and ideally also enum variants.
Would a PR that adds function support to add_attributes() be accepted?

CC @mkroening Any technical reason your PR did not implement support for functions, or did you just not need it for your usecase?

Edit: It seems that it also is not possible / intended to add attributes during the processing of the doc comment callback, so that would also need to be changed to support my usecase.

@mkroening
Copy link
Contributor

@mkroening Any technical reason your PR did not implement support for functions, or did you just not need it for your usecase?

Nope, no technical reason, I just built off the variants of --with-derive-custom, which do not support functions.

@pvdrz
Copy link
Contributor

pvdrz commented Dec 5, 2024

I think this is a reasonable feature, it only needs to be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants