Skip to content

Commit 43a3931

Browse files
nbdd0121ojeda
authored andcommitted
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>
1 parent 6b5a2b7 commit 43a3931

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

rust/kernel/prelude.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ pub use pin_init::{
6161
};
6262

6363
#[doc(no_inline)]
64-
pub use zerocopy::FromBytes;
64+
pub use zerocopy::{
65+
FromBytes,
66+
IntoBytes, //
67+
};
6568

6669
#[doc(no_inline)]
67-
pub use zerocopy_derive::FromBytes;
70+
pub use zerocopy_derive::{
71+
FromBytes,
72+
IntoBytes, //
73+
};
6874

6975
#[doc(no_inline)]
7076
pub use super::{

0 commit comments

Comments
 (0)