auto merge of #19169 : aturon/rust/fds, r=alexcrichton
This PR adds some internal infrastructure to allow the private `std::sys` module to access internal representation details of `std::io`. It then exposes those details in two new, platform-specific API surfaces: `std::os::unix` and `std::os::windows`. To start with, these will provide the ability to extract file descriptors, HANDLEs, SOCKETs, and so on from `std::io` types. More functionality, and more specific platforms (e.g. `std::os::linux`) will be added over time. Closes #18897
This commit is contained in:
commit
61af402789
15 changed files with 287 additions and 19 deletions
|
@ -13,7 +13,7 @@
|
|||
|
||||
use io::{mod, IoError, IoResult};
|
||||
use prelude::*;
|
||||
use sys::{last_error, retry, fs};
|
||||
use sys::{last_error, retry};
|
||||
use c_str::CString;
|
||||
use num::Int;
|
||||
use path::BytesContainer;
|
||||
|
@ -84,10 +84,9 @@ pub fn keep_going(data: &[u8], f: |*const u8, uint| -> i64) -> i64 {
|
|||
return (origamt - amt) as i64;
|
||||
}
|
||||
|
||||
// traits for extracting representations from
|
||||
|
||||
pub trait AsFileDesc {
|
||||
fn as_fd(&self) -> &fs::FileDesc;
|
||||
// A trait for extracting representations from std::io types
|
||||
pub trait AsInner<Inner> {
|
||||
fn as_inner(&self) -> &Inner;
|
||||
}
|
||||
|
||||
pub trait ProcessConfig<K: BytesContainer, V: BytesContainer> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue