3
3
#![ stable( feature = "process_extensions" , since = "1.2.0" ) ]
4
4
5
5
use crate :: ffi:: OsStr ;
6
- use crate :: os:: windows:: io:: { AsRawHandle , FromRawHandle , IntoRawHandle , RawHandle } ;
6
+ use crate :: os:: windows:: io:: { AsRawHandle , FromRawHandle , IntoRawHandle , OwnedHandle , RawHandle } ;
7
7
use crate :: process;
8
8
use crate :: sealed:: Sealed ;
9
9
use crate :: sys;
@@ -18,6 +18,15 @@ impl FromRawHandle for process::Stdio {
18
18
}
19
19
}
20
20
21
+ #[ unstable( feature = "io_safety" , issue = "87074" ) ]
22
+ impl From < OwnedHandle > for process:: Stdio {
23
+ fn from ( handle : OwnedHandle ) -> process:: Stdio {
24
+ let handle = sys:: handle:: Handle :: from_handle ( handle) ;
25
+ let io = sys:: process:: Stdio :: Handle ( handle) ;
26
+ process:: Stdio :: from_inner ( io)
27
+ }
28
+ }
29
+
21
30
#[ stable( feature = "process_extensions" , since = "1.2.0" ) ]
22
31
impl AsRawHandle for process:: Child {
23
32
#[ inline]
@@ -26,13 +35,28 @@ impl AsRawHandle for process::Child {
26
35
}
27
36
}
28
37
38
+ #[ unstable( feature = "io_safety" , issue = "87074" ) ]
39
+ impl AsHandle for process:: Child {
40
+ #[ inline]
41
+ fn as_handle ( & self ) -> BorrowedHandle < ' _ > {
42
+ self . as_inner ( ) . handle ( ) . as_handle ( )
43
+ }
44
+ }
45
+
29
46
#[ stable( feature = "into_raw_os" , since = "1.4.0" ) ]
30
47
impl IntoRawHandle for process:: Child {
31
48
fn into_raw_handle ( self ) -> RawHandle {
32
49
self . into_inner ( ) . into_handle ( ) . into_raw_handle ( ) as * mut _
33
50
}
34
51
}
35
52
53
+ #[ unstable( feature = "io_safety" , issue = "87074" ) ]
54
+ impl IntoHandle for process:: Child {
55
+ fn into_handle ( self ) -> BorrowedHandle < ' _ > {
56
+ self . into_inner ( ) . into_handle ( ) . into_handle ( )
57
+ }
58
+ }
59
+
36
60
#[ stable( feature = "process_extensions" , since = "1.2.0" ) ]
37
61
impl AsRawHandle for process:: ChildStdin {
38
62
#[ inline]
0 commit comments