Skip to content

Commit fe66e7c

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 14a70e5 commit fe66e7c

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
@@ -57,6 +57,11 @@ pub use uapi;
5757
#[doc(hidden)]
5858
pub use build_error::build_error;
5959

60+
pub(crate) mod private {
61+
#[allow(unreachable_pub)]
62+
pub trait Sealed {}
63+
}
64+
6065
/// Prefix to appear before log messages printed from within the `kernel` crate.
6166
const __LOG_PREFIX: &[u8] = b"rust_kernel\0";
6267

0 commit comments

Comments
 (0)