]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: kernel: add `fmt` module
authorTamir Duberstein <tamird@gmail.com>
Fri, 4 Jul 2025 20:14:53 +0000 (16:14 -0400)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 20 Jul 2025 23:16:35 +0000 (01:16 +0200)
`kernel::fmt` is a facade over `core::fmt` that can be used downstream,
allowing future changes to the formatting machinery to be contained
within the kernel crate without downstream code needing to be modified.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20250704-core-cstr-prepare-v1-2-a91524037783@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/fmt.rs [new file with mode: 0644]
rust/kernel/lib.rs

diff --git a/rust/kernel/fmt.rs b/rust/kernel/fmt.rs
new file mode 100644 (file)
index 0000000..0306e83
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//! Formatting utilities.
+//!
+//! This module is intended to be used in place of `core::fmt` in kernel code.
+
+pub use core::fmt::{Arguments, Debug, Display, Error, Formatter, Result, Write};
index 38c07f35073b157dd6750f9dfc44aace00ae4bae..e88bc4b27d6e367f0296381c8d6b22de21d69f54 100644 (file)
@@ -78,6 +78,7 @@ pub mod error;
 pub mod faux;
 #[cfg(CONFIG_RUST_FW_LOADER_ABSTRACTIONS)]
 pub mod firmware;
+pub mod fmt;
 pub mod fs;
 pub mod init;
 pub mod io;