From ab08639e5950f5c8a42a2870c9636181308c3686 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 28 Jul 2021 06:28:06 -0700 Subject: [PATCH] Add comments about impls for File, TcpStream, ChildStdin, etc. --- library/std/src/fs.rs | 6 ++++++ library/std/src/net/tcp.rs | 12 ++++++++++++ library/std/src/net/udp.rs | 6 ++++++ library/std/src/process.rs | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 2c04481c04e..bdb172907ff 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -587,6 +587,12 @@ impl File { } } +// In addition to the `impl`s here, `File` also has `impl`s for +// `AsFd`/`From`/`Into` and +// `AsRawFd`/`IntoRawFd`/`FromRawFd`, on Unix and WASI, and +// `AsHandle`/`From`/`Into` and +// `AsRawHandle`/`IntoRawHandle`/`FromRawHandle` on Windows. + impl AsInner for File { fn as_inner(&self) -> &fs_imp::File { &self.inner diff --git a/library/std/src/net/tcp.rs b/library/std/src/net/tcp.rs index 325acf0b979..7f964e5c5a9 100644 --- a/library/std/src/net/tcp.rs +++ b/library/std/src/net/tcp.rs @@ -546,6 +546,12 @@ impl TcpStream { } } +// In addition to the `impl`s here, `TcpStream` also has `impl`s for +// `AsFd`/`From`/`Into` and +// `AsRawFd`/`IntoRawFd`/`FromRawFd`, on Unix and WASI, and +// `AsSocket`/`From`/`Into` and +// `AsRawSocket`/`IntoRawSocket`/`FromRawSocket` on Windows. + #[stable(feature = "rust1", since = "1.0.0")] impl Read for TcpStream { fn read(&mut self, buf: &mut [u8]) -> io::Result { @@ -908,6 +914,12 @@ impl TcpListener { } } +// In addition to the `impl`s here, `TcpListener` also has `impl`s for +// `AsFd`/`From`/`Into` and +// `AsRawFd`/`IntoRawFd`/`FromRawFd`, on Unix and WASI, and +// `AsSocket`/`From`/`Into` and +// `AsRawSocket`/`IntoRawSocket`/`FromRawSocket` on Windows. + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for Incoming<'a> { type Item = io::Result; diff --git a/library/std/src/net/udp.rs b/library/std/src/net/udp.rs index d2088a12b2c..871505843af 100644 --- a/library/std/src/net/udp.rs +++ b/library/std/src/net/udp.rs @@ -779,6 +779,12 @@ impl UdpSocket { } } +// In addition to the `impl`s here, `UdpSocket` also has `impl`s for +// `AsFd`/`From`/`Into` and +// `AsRawFd`/`IntoRawFd`/`FromRawFd`, on Unix and WASI, and +// `AsSocket`/`From`/`Into` and +// `AsRawSocket`/`IntoRawSocket`/`FromRawSocket` on Windows. + impl AsInner for UdpSocket { fn as_inner(&self) -> &net_imp::UdpSocket { &self.0 diff --git a/library/std/src/process.rs b/library/std/src/process.rs index f5ce5210f81..c9b21fcf9c6 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -258,6 +258,12 @@ pub struct ChildStdin { inner: AnonPipe, } +// In addition to the `impl`s here, `ChildStdin` also has `impl`s for +// `AsFd`/`From`/`Into` and +// `AsRawFd`/`IntoRawFd`/`FromRawFd`, on Unix and WASI, and +// `AsHandle`/`From`/`Into` and +// `AsRawHandle`/`IntoRawHandle`/`FromRawHandle` on Windows. + #[stable(feature = "process", since = "1.0.0")] impl Write for ChildStdin { fn write(&mut self, buf: &[u8]) -> io::Result { @@ -335,6 +341,12 @@ pub struct ChildStdout { inner: AnonPipe, } +// In addition to the `impl`s here, `ChildStdout` also has `impl`s for +// `AsFd`/`From`/`Into` and +// `AsRawFd`/`IntoRawFd`/`FromRawFd`, on Unix and WASI, and +// `AsHandle`/`From`/`Into` and +// `AsRawHandle`/`IntoRawHandle`/`FromRawHandle` on Windows. + #[stable(feature = "process", since = "1.0.0")] impl Read for ChildStdout { fn read(&mut self, buf: &mut [u8]) -> io::Result { @@ -396,6 +408,12 @@ pub struct ChildStderr { inner: AnonPipe, } +// In addition to the `impl`s here, `ChildStderr` also has `impl`s for +// `AsFd`/`From`/`Into` and +// `AsRawFd`/`IntoRawFd`/`FromRawFd`, on Unix and WASI, and +// `AsHandle`/`From`/`Into` and +// `AsRawHandle`/`IntoRawHandle`/`FromRawHandle` on Windows. + #[stable(feature = "process", since = "1.0.0")] impl Read for ChildStderr { fn read(&mut self, buf: &mut [u8]) -> io::Result {