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

[Suggestion] Make ConfigBuilder return itself #93

Open
alexmozaidze opened this issue Jan 15, 2022 · 2 comments
Open

[Suggestion] Make ConfigBuilder return itself #93

alexmozaidze opened this issue Jan 15, 2022 · 2 comments

Comments

@alexmozaidze
Copy link

alexmozaidze commented Jan 15, 2022

There's a thing in Rust called builder pattern which is super convinient to build a struct in-place, ConfigBuilder, however, doesn't do that, it instead needs a mutable reference, can you add methods to construct ConfigBuilder in-place? I also think that reading ConfigBuilder docs is a bit of a pain when every option starts with set_, it makes it harder to read.

@imxood
Copy link

imxood commented May 28, 2022

ConfigBuilder's functions should return self, this will be especially convenient to use
ConfigBuilder::new().set_time_offset_to_local()

It doesn't need written two extra lines:

let mut builder = ConfigBuilder::new();
builder.set_time_offset_to_local()
... builder ...

@imxood
Copy link

imxood commented May 28, 2022

Change ConfigBuilder return itself #103

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

No branches or pull requests

2 participants