-
Notifications
You must be signed in to change notification settings - Fork 187
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
generator: Skip setters on returnedonly="true"
structs
#919
base: master
Are you sure you want to change the base?
Conversation
Note also that |
Vulkan annotates structs that are purely returned by the driver and do not have to be constructed by users (besides initializing `sType`/ `pNext`). For these we can skip all builder functions (except `push_next()` and the `CStr`/slice getter helpers) and lighten our codebase somewhat. Note that it is still possible to update the structure in a more low-level way by directly acessing the fields (or via FRU syntax). For Rust-based layer implementations this may be somewhat cumbersome, for which we could re-expose the setters behind a `cfg(feature = "returnedonly-setters")` of sorts?
For completeness, note that upstream does not set |
Sounds like a good idea to me. Perhaps
Hmm, seems like this should probably be an attribute on individual fields rather than entire structs. |
#deprecated | ||
#[inline] | ||
pub fn #param_ident_short(mut self, #param_ident_short: &CStr) -> core::result::Result<Self, CStrTooLargeForStaticArray> { | ||
write_c_str_slice_with_nul(&mut self.#param_ident, #param_ident_short).map(|()| self) | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting issue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bunch of code is so large that rustfmt
refuses to deal with it. I don't like fixing it up (incorrectly) manually either, we should figure out how to split it up into formattable functions.
Perhaps that's something @oddhack can help us out with, but I can also report it upstream. A lot of Otherwise a |
Vulkan annotates structs that are purely returned by the driver and do not have to be constructed by users (besides initializing
sType
/pNext
). For these we can skip all builder functions (exceptpush_next()
and theCStr
/slice getter helpers) and lighten our codebase somewhat.Note that it is still possible to update the structure in a more low-level way by directly acessing the fields (or via FRU syntax). For Rust-based layer implementations this may be somewhat cumbersome, for which we could re-expose the setters behind a
cfg(feature = "returnedonly-setters")
of sorts?