summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsahi Lina <lina@asahilina.net>2023-02-05 20:29:01 +0900
committerDanilo Krummrich <dakr@kernel.org>2024-08-13 15:54:19 +0200
commit0e9819b9e529ffe6e490d0c58212ab9c35665f59 (patch)
treec8a217a06c7592b2ee4d0012fd487ff812fd191f
parent47819d0c620c26449390ded381fcf64fea340edd (diff)
rust: Add a Sealed trait
Some traits exposed by the kernel crate may not be intended to be implemented by downstream modules. Add a Sealed trait to allow avoiding this using the sealed trait pattern. Signed-off-by: Asahi Lina <lina@asahilina.net> Signed-off-by: Danilo Krummrich <dakr@redhat.com>
-rw-r--r--rust/kernel/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 097fa87b1ed7..7475b8d8d822 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -72,6 +72,11 @@ pub use uapi;
#[doc(hidden)]
pub use build_error::build_error;
+pub(crate) mod private {
+ #[allow(unreachable_pub)]
+ pub trait Sealed {}
+}
+
/// Prefix to appear before log messages printed from within the `kernel` crate.
const __LOG_PREFIX: &[u8] = b"rust_kernel\0";