]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #40842 - Mic92:RawFd, r=aturon
authorCorey Farwell <coreyf@rwell.org>
Fri, 31 Mar 2017 15:43:31 +0000 (11:43 -0400)
committerGitHub <noreply@github.com>
Fri, 31 Mar 2017 15:43:31 +0000 (11:43 -0400)
Implement AsRawFd/IntoRawFd for RawFd

This is useful to build os abstraction like the nix crate does.
It allows to define functions, which accepts generic arguments
of data structures convertible to RawFd, including RawFd itself.
For example:

```
fn write<FD: AsRawFd>(fd: FD, buf: &[u8]) -> Result<usize>
write(file, buf);
```
instead of:
```
fn write(fd: RawFd, buf: &[u8]) -> Result<usize>
write(file.as_raw_fd(), buf);
```

cc @kamalmarhubi


Trivial merge