You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
TL;DR: Add a
fn get_documentation(&self) -> Option<&'static str>
method toEnumMessage
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 forcargo doc
. It would be nice if it were possible to specify the text only once. Havingget_documentation
would allow me to use the documentation by default, and allow the user to override it by specifying an explicit message if needed.The text was updated successfully, but these errors were encountered: