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
I do work with @TheNeikos in an open source project where we introduced "self-describing" configuration types.
That means that we provided a derive macro that could be used on config types so that fetching an explanation of what that type meant is possible. The derive-macro used the doc comments for that.
We should explore how it would be possible to add something like this to this crate.
As a quick example for some imaginary crate:
#[derive(Debug, config::ConfigDescription)]structMyConfig{/// The URL to fetch data fromurl: url::Url,/// The verbosity while fetchingverbosity:Verbosity,}#[derive(Debug, config::ConfigDescription)]enumVerbosity{/// be loudLoud,/// be louder than normalLouder,/// be as loud as possibleLoudest,}// somewhere:MyConfig::config_description()// returns ConfigDescription object that can be rendered for the user in a nice way
Resuling in approximately this output:
[table]
The URL to fetch data from
url: An URL
An UTF-8 encoded String
The verbosity while fetching
verbosity: Verbosity
one of:
"load" - be loud
"louder" - be louder than normal
"loudest" - be as loud as possible
The text was updated successfully, but these errors were encountered:
With a derive-macro, it would probably be possible to print the structure of a config input for any format supported. It could be useful while defining the config struct and easily knowing how to "feed" it.
I would love to work on this issue, if possible! I should say I'm still fairly new to Rust, but I think writing a derive macro would be a good first issue!
I do work with @TheNeikos in an open source project where we introduced "self-describing" configuration types.
That means that we provided a derive macro that could be used on config types so that fetching an explanation of what that type meant is possible. The derive-macro used the doc comments for that.
We should explore how it would be possible to add something like this to this crate.
As a quick example for some imaginary crate:
Resuling in approximately this output:
The text was updated successfully, but these errors were encountered: