Skip to content

models: Add missing pub declarations #3120

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

Merged
merged 1 commit into from
Dec 28, 2020
Merged

models: Add missing pub declarations #3120

merged 1 commit into from
Dec 28, 2020

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Dec 25, 2020

Without these declarations it is quite hard to use these model structs outside of their files, and since the structs themselves are pub it makes sense for their fields to also be public.

r? @pietroalbini

@pietroalbini
Copy link
Member

The intent of the fields not being pub is to force new initializations to go through the new method, which also does some validation. Why do you need the fields to be public?

@Turbo87
Copy link
Member Author

Turbo87 commented Dec 28, 2020

I primarily need it on the ReverseDependency to replace the encodable() method with a From implementation. Without the fields being pub it is not possible to access the fields from the views module.

I added the other structs because I thought it would make sense for all of the structs in the models module to have pub fields, but maybe you're right. Do you want me to remove the other structs and only keep the rev dep commit?

@Turbo87 Turbo87 force-pushed the pub branch 2 times, most recently from e140804 to 9403102 Compare December 28, 2020 12:38
@pietroalbini
Copy link
Member

Ok, so, we definitely don't want fields to be pub for NewVersion (or any New*). For the others, I'd say let's add pub only when it's needed.

@Turbo87
Copy link
Member Author

Turbo87 commented Dec 28, 2020

okay, I've removed the other three commits for now :)

@pietroalbini
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 28, 2020

📌 Commit 5a937a3 has been approved by pietroalbini

@bors
Copy link
Contributor

bors commented Dec 28, 2020

⌛ Testing commit 5a937a3 with merge cce3de8...

@bors
Copy link
Contributor

bors commented Dec 28, 2020

☀️ Test successful - checks-actions
Approved by: pietroalbini
Pushing cce3de8 to master...

@bors bors merged commit cce3de8 into rust-lang:master Dec 28, 2020
@Turbo87 Turbo87 deleted the pub branch December 28, 2020 15:07
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.

4 participants