Rollup merge of #77724 - sunfishcode:stdinlock-asrawfd, r=alexcrichton

Implement `AsRawFd` for `StdinLock` etc. on WASI.

WASI implements `AsRawFd` for `Stdin`, `Stdout`, and `Stderr`, so
implement it for `StdinLock`, `StdoutLock`, and `StderrLock` as well.

r? @alexcrichton
This commit is contained in:
Yuki Okushi 2020-10-13 04:07:54 +09:00 committed by GitHub
commit ad6e179060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,3 +160,21 @@ impl AsRawFd for io::Stderr {
sys::stdio::Stderr.as_raw_fd() sys::stdio::Stderr.as_raw_fd()
} }
} }
impl<'a> AsRawFd for io::StdinLock<'a> {
fn as_raw_fd(&self) -> RawFd {
sys::stdio::Stdin.as_raw_fd()
}
}
impl<'a> AsRawFd for io::StdoutLock<'a> {
fn as_raw_fd(&self) -> RawFd {
sys::stdio::Stdout.as_raw_fd()
}
}
impl<'a> AsRawFd for io::StderrLock<'a> {
fn as_raw_fd(&self) -> RawFd {
sys::stdio::Stderr.as_raw_fd()
}
}