linux/rust/macros
Benno Lossin 071cedc84e 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: Asahi Lina <lina@asahilina.net>
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Martin 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: Miguel Ojeda <ojeda@kernel.org>
2023-08-21 14:31:48 +02:00
..
concat_idents.rs rust: macros: add concat_idents! proc macro 2022-12-04 01:59:04 +01:00
helpers.rs rust: macros: refactor generics parsing of #[pin_data] into its own function 2023-05-31 18:53:09 +02:00
lib.rs rust: add derive macro for Zeroable 2023-08-21 14:31:48 +02:00
module.rs btf, scripts: rust: drop is_rust_module.sh 2023-08-10 22:28:04 +02:00
paste.rs rust: macros: add paste! proc macro 2023-08-10 22:28:02 +02:00
pin_data.rs rust: macros: replace Self with the concrete type in #[pin_data] 2023-05-31 18:53:09 +02:00
pinned_drop.rs rust: init: add PinnedDrop trait and macros 2023-04-12 18:41:05 +02:00
quote.rs rust: add derive macro for Zeroable 2023-08-21 14:31:48 +02:00
vtable.rs rust: macros: add #[vtable] proc macro 2022-12-04 01:59:15 +01:00
zeroable.rs rust: add derive macro for Zeroable 2023-08-21 14:31:48 +02:00