FILE
prelude.rs
File preview with syntax highlighting.
linux-6.19.14/rust/kernel/prelude.rs
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)] 15pub use core::{ 16 mem::{align_of, align_of_val, size_of, size_of_val}, 17 pin::Pin, 18}; 19 20pub use ::ffi::{ 21 c_char, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, c_ulong, c_ulonglong, 22 c_ushort, c_void, CStr, 23}; 24 25pub use crate::alloc::{flags::*, Box, KBox, KVBox, KVVec, KVec, VBox, VVec, Vec}; 26 27#[doc(no_inline)] 28pub use macros::{export, fmt, kunit_tests, module, vtable}; 29 30pub use pin_init::{init, pin_data, pin_init, pinned_drop, InPlaceWrite, Init, PinInit, Zeroable}; 31 32pub use super::{build_assert, build_error}; 33 34// `super::std_vendor` is hidden, which makes the macro inline for some reason. 35#[doc(no_inline)] 36pub use super::dbg; 37pub use super::{dev_alert, dev_crit, dev_dbg, dev_emerg, dev_err, dev_info, dev_notice, dev_warn}; 38pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn}; 39 40pub use super::{try_init, try_pin_init}; 41 42pub use super::static_assert; 43 44pub use super::error::{code::*, Error, Result}; 45 46pub use super::{str::CStrExt as _, ThisModule}; 47 48pub use super::init::InPlaceInit; 49 50pub use super::current; 51 52pub use super::uaccess::UserPtr; 53 54#[cfg(not(CONFIG_RUSTC_HAS_SLICE_AS_FLATTENED))] 55pub use super::slice::AsFlattened;
~/
Read-only file preview.