diff options
author | Asahi Lina <lina@asahilina.net> | 2023-02-05 20:29:01 +0900 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2024-10-22 22:55:10 +0200 |
commit | b4b3744a482ce965dfa22208ae0b4fc207997079 (patch) | |
tree | b8b29ccb84b792b4e32afff2b3d4b209f2d137dc /rust | |
parent | 370a36f1198b9e6ffce9dada51e0f530d6dc4739 (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@kernel.org>
Diffstat (limited to 'rust')
-rw-r--r-- | rust/kernel/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index d237760fd9bd..e89edd672acd 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -84,6 +84,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"; |