[PATCH] rust: prelude: add `zerocopy{,_derive}::IntoBytes`
From: Gary Guo
Date: Thu Jun 11 2026 - 09:52:22 EST
From: Gary Guo <gary@xxxxxxxxxxx>
In order to easily use `IntoBytes`, add it to the prelude.
This adds both the trait (`zerocopy::IntoBytes`) as well as the derive
macro (`zerocopy_derive::IntoBytes`).
Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
---
This is wanted because I want to convert the upcoming I/O projection series
to use `zerocopy` traits rather than keep using transmute module.
It is most helpful for derives in doc tests; I do not want to explicitly use
`#[derive(zerocopy_derive::IntoBytes)]` in the doc tests.
---
rust/kernel/prelude.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
index ca260cc3937a..a97cb0af5d02 100644
--- a/rust/kernel/prelude.rs
+++ b/rust/kernel/prelude.rs
@@ -61,10 +61,16 @@
};
#[doc(no_inline)]
-pub use zerocopy::FromBytes;
+pub use zerocopy::{
+ FromBytes,
+ IntoBytes, //
+};
#[doc(no_inline)]
-pub use zerocopy_derive::FromBytes;
+pub use zerocopy_derive::{
+ FromBytes,
+ IntoBytes, //
+};
#[doc(no_inline)]
pub use super::{
base-commit: 98cc68794c003bc76fc9da2e8a075e947eee5921
--
2.54.0