]> git.lizzy.rs Git - rust.git/commitdiff
Document behavior of set_nonblocking on UnixListener
authorTill Arnold <throwable42@gmail.com>
Sun, 12 Jan 2020 11:01:37 +0000 (12:01 +0100)
committerTill Arnold <throwable42@gmail.com>
Sun, 12 Jan 2020 11:01:37 +0000 (12:01 +0100)
src/libstd/sys/unix/ext/net.rs

index e0e6e02a443e1f5856cfac5332388e051d2a6c8a..4c3cb67c9ee0f795eff34a31f57acc960966cf72 100644 (file)
@@ -902,6 +902,12 @@ pub fn local_addr(&self) -> io::Result<SocketAddr> {
 
     /// Moves the socket into or out of nonblocking mode.
     ///
+    /// This will result in the `accept` operation becoming nonblocking,
+    /// i.e., immediately returning from their calls. If the IO operation is
+    /// successful, `Ok` is returned and no further action is required. If the
+    /// IO operation could not be completed and needs to be retried, an error
+    /// with kind [`io::ErrorKind::WouldBlock`] is returned.
+    ///
     /// # Examples
     ///
     /// ```no_run
@@ -913,6 +919,8 @@ pub fn local_addr(&self) -> io::Result<SocketAddr> {
     ///     Ok(())
     /// }
     /// ```
+    ///
+    /// [`io::ErrorKind::WouldBlock`]: ../../../io/enum.ErrorKind.html#variant.WouldBlock
     #[stable(feature = "unix_socket", since = "1.10.0")]
     pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
         self.0.set_nonblocking(nonblocking)