File tree 3 files changed +14
-2
lines changed
3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,10 @@ pub mod unix;
82
82
#[ cfg( windows) ]
83
83
pub mod windows;
84
84
85
+ mod sealed {
86
+ pub trait Sealed { }
87
+ }
88
+
85
89
/// An event delivered every time the SIGCHLD signal occurs.
86
90
static SIGCHLD : Event = Event :: new ( ) ;
87
91
Original file line number Diff line number Diff line change @@ -7,7 +7,10 @@ use std::os::unix::process::CommandExt as _;
7
7
use crate :: Command ;
8
8
9
9
/// Unix-specific extensions to the [`Command`] builder.
10
- pub trait CommandExt {
10
+ ///
11
+ /// This trait is sealed: it cannot be implemented outside `async-process`.
12
+ /// This is so that future additional methods are not breaking changes.
13
+ pub trait CommandExt : crate :: sealed:: Sealed {
11
14
/// Sets the child process's user ID. This translates to a
12
15
/// `setuid` call in the child process. Failure in the `setuid`
13
16
/// call will cause the spawn to fail.
@@ -88,6 +91,7 @@ pub trait CommandExt {
88
91
S : AsRef < OsStr > ;
89
92
}
90
93
94
+ impl crate :: sealed:: Sealed for Command { }
91
95
impl CommandExt for Command {
92
96
fn uid ( & mut self , id : u32 ) -> & mut Command {
93
97
self . inner . uid ( id) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ use std::os::windows::process::CommandExt as _;
6
6
use crate :: { Child , Command } ;
7
7
8
8
/// Windows-specific extensions to the [`Command`] builder.
9
- pub trait CommandExt {
9
+ ///
10
+ /// This trait is sealed: it cannot be implemented outside `async-process`.
11
+ /// This is so that future additional methods are not breaking changes.
12
+ pub trait CommandExt : crate :: sealed:: Sealed {
10
13
/// Sets the [process creation flags][1] to be passed to `CreateProcess`.
11
14
///
12
15
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
@@ -15,6 +18,7 @@ pub trait CommandExt {
15
18
fn creation_flags ( & mut self , flags : u32 ) -> & mut Command ;
16
19
}
17
20
21
+ impl crate :: sealed:: Sealed for Command { }
18
22
impl CommandExt for Command {
19
23
fn creation_flags ( & mut self , flags : u32 ) -> & mut Command {
20
24
self . inner . creation_flags ( flags) ;
You can’t perform that action at this time.
0 commit comments