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

About getter pattern #168

Open
wiiznokes opened this issue Nov 14, 2023 · 1 comment
Open

About getter pattern #168

wiiznokes opened this issue Nov 14, 2023 · 1 comment

Comments

@wiiznokes
Copy link

Looking at the code a little, I saw that a good part of the structures use a getter pattern. I find this a shame because in fact, the Setting or BundleSettings structure is still missing a lot of keywords, and having to implement a setter each time is redundant. It feels like Java.

In addition, it does not contribute much in the majority of cases because

  • the structure is passed between functions as a non-mutable ref, so there is no risk of modifying it inadvertently.

  • getters provide an impl of default(), which can be automatically done with serde.

So can I start adding public fields?

@wiiznokes
Copy link
Author

wiiznokes commented Nov 14, 2023

Also, why not use an enum for the different targets (deb, msi, ...)

We could imagine a something like this:

enum BundleSettings {
   name: Option<String>,
   deb: Deb(BundleDebSettings),
   msi: Msi(BundleMsiSettings),
}

And having this out of the box:
[package.metadata.bundle.example.hello.deb]

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

1 participant