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.
This commit is contained in:
Dan Gohman 2020-10-08 07:31:55 -07:00
parent 6b8d7911a1
commit 8d2c622d48

View File

@ -160,3 +160,21 @@ impl AsRawFd for io::Stderr {
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()
}
}