summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2026-06-11 14:48:01 +0100
committerMiguel Ojeda <ojeda@kernel.org>2026-06-17 00:32:42 +0200
commit43a393185e33e573a374c1d4f7ddf6481484ef8d (patch)
treecafde21753a8329f75e85125e7ff2167b930b2fc /rust/kernel
parent6b5a2b7d9bc156e505f09e698d85d6a1547c1206 (diff)
downloadlwn-43a393185e33e573a374c1d4f7ddf6481484ef8d.tar.gz
lwn-43a393185e33e573a374c1d4f7ddf6481484ef8d.zip
rust: prelude: add `zerocopy{,_derive}::IntoBytes`
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`). [ This patch will simplify using the feature in several trees next cycle. Gary writes: 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. For reference, the upcoming I/O projection series is at: https://lore.kernel.org/rust-for-linux/20260611-io_projection-v4-0-1f7224b02dcb@garyguo.net/ - Miguel ] Signed-off-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260611134802.2052296-1-gary@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r--rust/kernel/prelude.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
index 8a6da92e8da6..ca396f1f78a6 100644
--- a/rust/kernel/prelude.rs
+++ b/rust/kernel/prelude.rs
@@ -61,10 +61,16 @@ pub use pin_init::{
};
#[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::{