diff options
Diffstat (limited to 'src/net/unix/split.rs')
-rw-r--r-- | src/net/unix/split.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/net/unix/split.rs b/src/net/unix/split.rs index 816a257..6fc7067 100644 --- a/src/net/unix/split.rs +++ b/src/net/unix/split.rs @@ -55,9 +55,20 @@ pub(crate) fn split(stream: &mut UnixStream) -> (ReadHalf<'_>, WriteHalf<'_>) { impl ReadHalf<'_> { /// Wait for any of the requested ready states. /// - /// This function is usually paired with `try_read()` or `try_write()`. It - /// can be used to concurrently read / write to the same socket on a single - /// task without splitting the socket. + /// This function is usually paired with [`try_read()`]. It can be used instead + /// of [`readable()`] to check the returned ready set for [`Ready::READABLE`] + /// and [`Ready::READ_CLOSED`] events. + /// + /// The function may complete without the socket being ready. This is a + /// false-positive and attempting an operation will return with + /// `io::ErrorKind::WouldBlock`. The function can also return with an empty + /// [`Ready`] set, so you should always check the returned value and possibly + /// wait again if the requested states are not set. + /// + /// This function is equivalent to [`UnixStream::ready`]. + /// + /// [`try_read()`]: Self::try_read + /// [`readable()`]: Self::readable /// /// # Cancel safety /// @@ -178,9 +189,9 @@ impl ReadHalf<'_> { impl WriteHalf<'_> { /// Waits for any of the requested ready states. /// - /// This function is usually paired with `try_read()` or `try_write()`. It - /// can be used to concurrently read / write to the same socket on a single - /// task without splitting the socket. + /// This function is usually paired with [`try_write()`]. It can be used instead + /// of [`writable()`] to check the returned ready set for [`Ready::WRITABLE`] + /// and [`Ready::WRITE_CLOSED`] events. /// /// The function may complete without the socket being ready. This is a /// false-positive and attempting an operation will return with @@ -188,6 +199,11 @@ impl WriteHalf<'_> { /// [`Ready`] set, so you should always check the returned value and possibly /// wait again if the requested states are not set. /// + /// This function is equivalent to [`UnixStream::ready`]. + /// + /// [`try_write()`]: Self::try_write + /// [`writable()`]: Self::writable + /// /// # Cancel safety /// /// This method is cancel safe. Once a readiness event occurs, the method |