mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
It is convenient to have all the `Error` constant items (such as `EINVAL`) available as-is everywhere (i.e. for code using the kernel prelude such as kernel modules). Therefore, add all of them to the prelude. For instance, this allows to write `Err(EINVAL)` to create a kernel `Result`: fn f() -> Result<...> { ... Err(EINVAL) } Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com> Reviewed-by: Gary Guo <gary@garyguo.net> [Reworded, adapted for upstream and applied latest changes] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
24 lines
537 B
Rust
24 lines
537 B
Rust
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//! The `kernel` prelude.
|
|
//!
|
|
//! These are the most common items used by Rust code in the kernel,
|
|
//! intended to be imported by all Rust code, for convenience.
|
|
//!
|
|
//! # Examples
|
|
//!
|
|
//! ```
|
|
//! use kernel::prelude::*;
|
|
//! ```
|
|
|
|
pub use core::pin::Pin;
|
|
|
|
pub use alloc::{boxed::Box, vec::Vec};
|
|
|
|
pub use macros::{module, vtable};
|
|
|
|
pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn};
|
|
|
|
pub use super::error::{code::*, Error, Result};
|
|
|
|
pub use super::ThisModule;
|