diff options
author | Benno Lossin <benno.lossin@proton.me> | 2023-08-14 10:47:10 +0200 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2023-08-21 14:31:48 +0200 |
commit | 35e7fca2ff59d9d8f036aba3dcf5c34beb79fdb8 (patch) | |
tree | fb976465a2dd8e52d3017e10e885e3dc1f976ded /usr | |
parent | rust: init: make initializer values inaccessible after initializing (diff) | |
download | linux-35e7fca2ff59d9d8f036aba3dcf5c34beb79fdb8.tar.xz linux-35e7fca2ff59d9d8f036aba3dcf5c34beb79fdb8.zip |
rust: init: add `..Zeroable::zeroed()` syntax for zeroing all missing fields
Add the struct update syntax to the init macros, but only for
`..Zeroable::zeroed()`. Adding this at the end of the struct initializer
allows one to omit fields from the initializer, these fields will be
initialized with 0x00 set to every byte. Only types that implement the
`Zeroable` trait can utilize this.
Suggested-by: Asahi Lina <lina@asahilina.net>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20230814084602.25699-8-benno.lossin@proton.me
[ Rebased on `rust-next` and cleaned a few trivial nits. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'usr')
0 files changed, 0 insertions, 0 deletions