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

Rust: Generated structs do not have public fields #29

Closed
AdamLeyshon opened this issue Jul 12, 2021 · 1 comment
Closed

Rust: Generated structs do not have public fields #29

AdamLeyshon opened this issue Jul 12, 2021 · 1 comment

Comments

@AdamLeyshon
Copy link

Please allow an option to make the fields public during code generation.
This would allow people to instantiate the types and impl traits such as Default.

Instead of:

#[derive(Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Maintenance {
    #[serde(rename = "start_time")]
    start_time: u32,
}

Should yield:

#[derive(Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Maintenance {
    #[serde(rename = "start_time")]
    pub start_time: u32,
}
@AdamLeyshon
Copy link
Author

Ignore me, The cargo crate is 0.1.5 and looks to have been fixed sometime after.
Getting the binary release solved this.

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