1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Extensions to `std::process` for Windows.
13 #![stable(feature = "process_extensions", since = "1.2.0")]
15 use os
::windows
::io
::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}
;
18 use sys_common
::{AsInner, FromInner, IntoInner}
;
20 #[stable(feature = "process_extensions", since = "1.2.0")]
21 impl FromRawHandle
for process
::Stdio
{
22 unsafe fn from_raw_handle(handle
: RawHandle
) -> process
::Stdio
{
23 let handle
= sys
::handle
::Handle
::new(handle
as *mut _
);
24 process
::Stdio
::from_inner(handle
)
28 #[stable(feature = "process_extensions", since = "1.2.0")]
29 impl AsRawHandle
for process
::Child
{
30 fn as_raw_handle(&self) -> RawHandle
{
31 self.as_inner().handle().raw() as *mut _
35 #[stable(feature = "process_extensions", since = "1.2.0")]
36 impl IntoRawHandle
for process
::Child
{
37 fn into_raw_handle(self) -> RawHandle
{
38 self.into_inner().into_handle().into_raw() as *mut _
42 #[stable(feature = "process_extensions", since = "1.2.0")]
43 impl AsRawHandle
for process
::ChildStdin
{
44 fn as_raw_handle(&self) -> RawHandle
{
45 self.as_inner().handle().raw() as *mut _
49 #[stable(feature = "process_extensions", since = "1.2.0")]
50 impl AsRawHandle
for process
::ChildStdout
{
51 fn as_raw_handle(&self) -> RawHandle
{
52 self.as_inner().handle().raw() as *mut _
56 #[stable(feature = "process_extensions", since = "1.2.0")]
57 impl AsRawHandle
for process
::ChildStderr
{
58 fn as_raw_handle(&self) -> RawHandle
{
59 self.as_inner().handle().raw() as *mut _
63 #[stable(feature = "process_extensions", since = "1.2.0")]
64 impl IntoRawHandle
for process
::ChildStdin
{
65 fn into_raw_handle(self) -> RawHandle
{
66 self.into_inner().into_handle().into_raw() as *mut _
70 #[stable(feature = "process_extensions", since = "1.2.0")]
71 impl IntoRawHandle
for process
::ChildStdout
{
72 fn into_raw_handle(self) -> RawHandle
{
73 self.into_inner().into_handle().into_raw() as *mut _
77 #[stable(feature = "process_extensions", since = "1.2.0")]
78 impl IntoRawHandle
for process
::ChildStderr
{
79 fn into_raw_handle(self) -> RawHandle
{
80 self.into_inner().into_handle().into_raw() as *mut _