Skip to content
Commit 071cedc8 authored by Benno Lossin's avatar Benno Lossin Committed by Miguel Ojeda
Browse files

rust: add derive macro for `Zeroable`



Add a derive proc-macro for the `Zeroable` trait. The macro supports
structs where every field implements the `Zeroable` trait. This way
`unsafe` implementations can be avoided.

The macro is split into two parts:
- a proc-macro to parse generics into impl and ty generics,
- a declarative macro that expands to the impl block.

Suggested-by: default avatarAsahi Lina <lina@asahilina.net>
Signed-off-by: default avatarBenno Lossin <benno.lossin@proton.me>
Reviewed-by: default avatarGary Guo <gary@garyguo.net>
Reviewed-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
Link: https://lore.kernel.org/r/20230814084602.25699-4-benno.lossin@proton.me


[ Added `ignore` to the `lib.rs` example and cleaned trivial nit. ]
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent f8badd15
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment