diff options
| author | Aaron Turon <aturon@mozilla.com> | 2014-11-20 18:26:47 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2014-11-21 10:17:13 -0800 |
| commit | 4156bc44176d93296a0f1834690dd9792390cec6 (patch) | |
| tree | e0ed8ebfe17df893157b8d529dbdb22c57aee598 /src/libstd/sys/windows | |
| parent | c9f6d696420107f82304b992cf623b806995fe18 (diff) | |
| download | rust-4156bc44176d93296a0f1834690dd9792390cec6.tar.gz rust-4156bc44176d93296a0f1834690dd9792390cec6.zip | |
sys: reveal std::io representation to sys module
This commit adds a `AsInner` trait to `sys_common` and provides implementations on many `std::io` types. This is a building block for exposing platform-specific APIs that hook into `std::io` types.
Diffstat (limited to 'src/libstd/sys/windows')
| -rw-r--r-- | src/libstd/sys/windows/pipe.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sys/windows/process.rs | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index a623c2cd8e2..60bd2b1370f 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -329,7 +329,7 @@ impl UnixStream { } } - fn handle(&self) -> libc::HANDLE { self.inner.handle } + pub fn handle(&self) -> libc::HANDLE { self.inner.handle } fn read_closed(&self) -> bool { self.inner.read_closed.load(atomic::SeqCst) @@ -585,6 +585,10 @@ impl UnixListener { }), }) } + + pub fn handle(&self) -> libc::HANDLE { + self.handle + } } impl Drop for UnixListener { @@ -729,6 +733,10 @@ impl UnixAcceptor { Ok(()) } } + + pub fn handle(&self) -> libc::HANDLE { + self.event.ref0 + } } impl Clone for UnixAcceptor { diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 3fb5ee34356..eddb89c673d 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -26,7 +26,7 @@ use sys::fs; use sys::{mod, retry, c, wouldblock, set_nonblocking, ms_to_timeval, timer}; use sys::fs::FileDesc; use sys_common::helper_thread::Helper; -use sys_common::{AsFileDesc, mkerr_libc, timeout}; +use sys_common::{AsInner, mkerr_libc, timeout}; use io::fs::PathExtensions; use string::String; @@ -105,7 +105,7 @@ impl Process { pub fn spawn<K, V, C, P>(cfg: &C, in_fd: Option<P>, out_fd: Option<P>, err_fd: Option<P>) -> IoResult<Process> - where C: ProcessConfig<K, V>, P: AsFileDesc, + where C: ProcessConfig<K, V>, P: AsInner<FileDesc>, K: BytesContainer + Eq + Hash, V: BytesContainer { use libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO}; @@ -195,7 +195,7 @@ impl Process { } } Some(ref fd) => { - let orig = get_osfhandle(fd.as_fd().fd()) as HANDLE; + let orig = get_osfhandle(fd.as_inner().fd()) as HANDLE; if orig == INVALID_HANDLE_VALUE { return Err(super::last_error()) } |
