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

Make Manifest and Package easier to instantiate #22

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

Turbo87
Copy link
Collaborator

@Turbo87 Turbo87 commented Sep 18, 2023

Manifest and Package are currently quite annoying to instantiate because all the fields need to be explicitly assigned even if only a small subset is used.

This PR implements the Default trait for the Manifest struct allowing an instantiation like Manifest { package, ..Default::default() }.

This PR also adds a new() fn to the Package struct for similar reasons. An alternative to this is implementing Default too, but that would leave us with name: "" and version: "". I'm undecided which way feels better, but for new() there is prior art.

Finally, this PR also adds a small serialization test case, to ensure that these API keep working in the future :)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

src/lib.rs Outdated Show resolved Hide resolved
@LukeMathWalker LukeMathWalker merged commit 61c65f8 into LukeMathWalker:master Sep 18, 2023
3 of 4 checks passed
@Turbo87 Turbo87 deleted the serialize branch September 18, 2023 10:57
@Turbo87 Turbo87 added the enhancement New feature or request label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants