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

Feature Request: Allow access to per-discriminant structured documentation comment #203

Closed
orenbenkiki opened this issue Jan 7, 2022 · 1 comment · Fixed by #206
Closed

Comments

@orenbenkiki
Copy link
Contributor

orenbenkiki commented Jan 7, 2022

TL;DR: Add a fn get_documentation(&self) -> Option<&'static str> method to EnumMessage that would return the content of the /// ... comment for each option (if any).

Motivation: I have a system which uses user-defined enums to drive UI that lets the user select values. I can easily generate the list of possible values for a dropdown, but I'd like to also add a hover text describing each one.

The EnumMessage is almost perfect for this - except that I need to repeat the comment text both in the message for the UI, and also in comment for cargo doc. It would be nice if it were possible to specify the text only once. Having get_documentation would allow me to use the documentation by default, and allow the user to override it by specifying an explicit message if needed.

@Peternator7
Copy link
Owner

Related to #168

@Peternator7 Peternator7 linked a pull request Feb 12, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants