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

Add builder pattern for Config #366

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LonerDan
Copy link

Changes the way Config is constructed by introducing helper struct ConfigBuilder, which follows the builder pattern. This enables more ergonomic function call chaining, while still preserving the option to call them one by one as previously.

Based on this and this, the variant consuming and producing mutable references was chosen, since it allows both ergonomic function call chaining and manually calling individual functions, which is required in case of values set conditionally.
As a side effect, this also allows constructing multiple Configs from the same builder.

Changes the way `Config` is contructed by introducing helper struct `ConfigBuilder`, which follows the builder pattern. This enables more ergonomic function call chaining, while still preserving the option to call them one by one as previously.
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 this pull request may close these issues.

1 participant