@@ -1507,9 +1507,20 @@ impl windows::OpenOptionsExt for OpenOptions {
15071507 }
15081508}
15091509
1510+ mod __private {
1511+ #[ doc( hidden) ]
1512+ pub trait Sealed { }
1513+
1514+ impl Sealed for super :: OpenOptions { }
1515+ impl Sealed for super :: File { }
1516+ impl Sealed for super :: DirBuilder { }
1517+ impl Sealed for super :: DirEntry { }
1518+ }
1519+
15101520/// Unix-specific extensions.
15111521#[ cfg( unix) ]
15121522pub mod unix {
1523+ use super :: __private:: Sealed ;
15131524 use super :: * ;
15141525
15151526 #[ doc( no_inline) ]
@@ -1533,7 +1544,7 @@ pub mod unix {
15331544 }
15341545
15351546 /// Unix-specific extensions to [`DirBuilder`].
1536- pub trait DirBuilderExt {
1547+ pub trait DirBuilderExt : Sealed {
15371548 /// Sets the mode to create new directories with.
15381549 ///
15391550 /// This option defaults to `0o777`.
@@ -1550,7 +1561,7 @@ pub mod unix {
15501561 }
15511562
15521563 /// Unix-specific extension methods for [`DirEntry`].
1553- pub trait DirEntryExt {
1564+ pub trait DirEntryExt : Sealed {
15541565 /// Returns the underlying `d_ino` field in the contained `dirent` structure.
15551566 ///
15561567 /// # Examples
@@ -1571,7 +1582,7 @@ pub mod unix {
15711582 }
15721583
15731584 /// Unix-specific extensions to [`OpenOptions`].
1574- pub trait OpenOptionsExt {
1585+ pub trait OpenOptionsExt : Sealed {
15751586 /// Sets the mode bits that a new file will be created with.
15761587 ///
15771588 /// If a new file is created as part of an [`OpenOptions::open()`] call then this
@@ -1622,6 +1633,7 @@ pub mod unix {
16221633/// Windows-specific extensions.
16231634#[ cfg( windows) ]
16241635pub mod windows {
1636+ use super :: __private:: Sealed ;
16251637 use super :: * ;
16261638
16271639 #[ doc( no_inline) ]
@@ -1662,7 +1674,7 @@ pub mod windows {
16621674 }
16631675
16641676 /// Windows-specific extensions to [`OpenOptions`].
1665- pub trait OpenOptionsExt {
1677+ pub trait OpenOptionsExt : Sealed {
16661678 /// Overrides the `dwDesiredAccess` argument to the call to [`CreateFile`]
16671679 /// with the specified value.
16681680 ///
0 commit comments