xref: /linux/rust/kernel/prelude.rs (revision 352af6a011d586ff042db4b2d1f7421875eb8a14)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 //! The `kernel` prelude.
4 //!
5 //! These are the most common items used by Rust code in the kernel,
6 //! intended to be imported by all Rust code, for convenience.
7 //!
8 //! # Examples
9 //!
10 //! ```
11 //! use kernel::prelude::*;
12 //! ```
13 
14 #[doc(no_inline)]
15 pub use core::pin::Pin;
16 
17 pub use ::ffi::{
18     c_char, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, c_ulong, c_ulonglong,
19     c_ushort, c_void,
20 };
21 
22 pub use crate::alloc::{flags::*, Box, KBox, KVBox, KVVec, KVec, VBox, VVec, Vec};
23 
24 #[doc(no_inline)]
25 pub use macros::{export, kunit_tests, module, vtable};
26 
27 pub use pin_init::{init, pin_data, pin_init, pinned_drop, InPlaceWrite, Init, PinInit, Zeroable};
28 
29 pub use super::{build_assert, build_error};
30 
31 // `super::std_vendor` is hidden, which makes the macro inline for some reason.
32 #[doc(no_inline)]
33 pub use super::dbg;
34 pub use super::{dev_alert, dev_crit, dev_dbg, dev_emerg, dev_err, dev_info, dev_notice, dev_warn};
35 pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn};
36 pub use core::format_args as fmt;
37 
38 pub use super::{try_init, try_pin_init};
39 
40 pub use super::static_assert;
41 
42 pub use super::error::{code::*, Error, Result};
43 
44 pub use super::{str::CStr, ThisModule};
45 
46 pub use super::init::InPlaceInit;
47 
48 pub use super::current;
49 
50 pub use super::uaccess::UserPtr;
51