Skip to content

Commit 3383149

Browse files
asahilinaFabo
authored andcommitted
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 <[email protected]>
1 parent 6bdd6e6 commit 3383149

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rust/kernel/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ pub use uapi;
6161
#[doc(hidden)]
6262
pub use build_error::build_error;
6363

64+
pub(crate) mod private {
65+
#[allow(unreachable_pub)]
66+
pub trait Sealed {}
67+
}
68+
6469
/// Prefix to appear before log messages printed from within the `kernel` crate.
6570
const __LOG_PREFIX: &[u8] = b"rust_kernel\0";
6671

0 commit comments

Comments
 (0)