@@ -138,6 +138,8 @@ impl FileExt for fs::File {
138138}
139139
140140/// Windows-specific extensions to [`fs::OpenOptions`].
141+ // WARNING: This trait is not sealed. DON'T add any new methods!
142+ // Add them to OpenOptionsExt2 instead.
141143#[ stable( feature = "open_options_ext" , since = "1.10.0" ) ]
142144pub trait OpenOptionsExt {
143145 /// Overrides the `dwDesiredAccess` argument to the call to [`CreateFile`]
@@ -305,18 +307,6 @@ pub trait OpenOptionsExt {
305307 /// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-security_impersonation_level
306308 #[ stable( feature = "open_options_ext" , since = "1.10.0" ) ]
307309 fn security_qos_flags ( & mut self , flags : u32 ) -> & mut Self ;
308-
309- /// If set to `true`, prevent the "last access time" of the file from being changed.
310- ///
311- /// Default to `false`.
312- #[ unstable( feature = "windows_freeze_file_times" , issue = "149715" ) ]
313- fn freeze_last_access_time ( & mut self , freeze : bool ) -> & mut Self ;
314-
315- /// If set to `true`, prevent the "last write time" of the file from being changed.
316- ///
317- /// Default to `false`.
318- #[ unstable( feature = "windows_freeze_file_times" , issue = "149715" ) ]
319- fn freeze_last_write_time ( & mut self , freeze : bool ) -> & mut Self ;
320310}
321311
322312#[ stable( feature = "open_options_ext" , since = "1.10.0" ) ]
@@ -345,7 +335,28 @@ impl OpenOptionsExt for OpenOptions {
345335 self . as_inner_mut ( ) . security_qos_flags ( flags) ;
346336 self
347337 }
338+ }
339+
340+ #[ unstable( feature = "windows_freeze_file_times" , issue = "149715" ) ]
341+ pub trait OpenOptionsExt2 : Sealed {
342+ /// If set to `true`, prevent the "last access time" of the file from being changed.
343+ ///
344+ /// Default to `false`.
345+ #[ unstable( feature = "windows_freeze_file_times" , issue = "149715" ) ]
346+ fn freeze_last_access_time ( & mut self , freeze : bool ) -> & mut Self ;
347+
348+ /// If set to `true`, prevent the "last write time" of the file from being changed.
349+ ///
350+ /// Default to `false`.
351+ #[ unstable( feature = "windows_freeze_file_times" , issue = "149715" ) ]
352+ fn freeze_last_write_time ( & mut self , freeze : bool ) -> & mut Self ;
353+ }
354+
355+ #[ unstable( feature = "sealed" , issue = "none" ) ]
356+ impl Sealed for OpenOptions { }
348357
358+ #[ unstable( feature = "windows_freeze_file_times" , issue = "149715" ) ]
359+ impl OpenOptionsExt2 for OpenOptions {
349360 fn freeze_last_access_time ( & mut self , freeze : bool ) -> & mut Self {
350361 self . as_inner_mut ( ) . freeze_last_access_time ( freeze) ;
351362 self
0 commit comments