Skip to content

Commit 8d2c622

Browse files
committed
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.
1 parent 6b8d791 commit 8d2c622

File tree

1 file changed

+18
-0
lines changed
  • library/std/src/sys/wasi/ext

1 file changed

+18
-0
lines changed

library/std/src/sys/wasi/ext/io.rs

+18
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,21 @@ impl AsRawFd for io::Stderr {
160160
sys::stdio::Stderr.as_raw_fd()
161161
}
162162
}
163+
164+
impl<'a> AsRawFd for io::StdinLock<'a> {
165+
fn as_raw_fd(&self) -> RawFd {
166+
sys::stdio::Stdin.as_raw_fd()
167+
}
168+
}
169+
170+
impl<'a> AsRawFd for io::StdoutLock<'a> {
171+
fn as_raw_fd(&self) -> RawFd {
172+
sys::stdio::Stdout.as_raw_fd()
173+
}
174+
}
175+
176+
impl<'a> AsRawFd for io::StderrLock<'a> {
177+
fn as_raw_fd(&self) -> RawFd {
178+
sys::stdio::Stderr.as_raw_fd()
179+
}
180+
}

0 commit comments

Comments
 (0)