tiberius
tiberius copied to clipboard
Add builder pattern for Config
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.