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

Custom derive for CfgHelper #3

Open
vorner opened this issue Sep 2, 2018 · 1 comment
Open

Custom derive for CfgHelper #3

vorner opened this issue Sep 2, 2018 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@vorner
Copy link
Owner

vorner commented Sep 2, 2018

The CfgHelper is (hopefully) composable from sub-config sections, with adequate attribute annotations (supplying the action and name). This makes it a candidate for custom derive, which could provide the relevant extractors and cut down on boilerplate further.

There should be some option to skip a field from the custom derive.

A brainstorming suggestion for syntax:

#[derive(Deserialize, CfgHelper)]
struct Config {
    #[cfg_helper(name = "listener", action = "handle_conn")]
    listener: HashSet<TcpListen>,

    #[cfg_helper(skip)]
    msg: String,
}
@vorner vorner added the help wanted Extra attention is needed label Sep 2, 2018
@vorner
Copy link
Owner Author

vorner commented Oct 20, 2019

Note: it's no longer called a cfg helper. These are either extensions or pipelines. But both would use some kind of boilerplate reducer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant