net: add take_error to TcpSocket and TcpStream (#4739)

Co-authored-by: Taiki Endo <[email protected]>
This commit is contained in:
Max Inden
2022-06-03 19:50:52 +02:00
committed by GitHub
co-authored by Taiki Endo
parent 0d4d3c34f1
commit 42b4c27b88
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -424,6 +424,11 @@ impl TcpSocket {
self.inner.local_addr().and_then(convert_address)
}
/// Returns the value of the `SO_ERROR` option.
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
self.inner.take_error()
}
/// Binds the socket to the given address.
///
/// This calls the `bind(2)` operating-system function. Behavior is
+5
View File
@@ -264,6 +264,11 @@ impl TcpStream {
self.io.local_addr()
}
/// Returns the value of the `SO_ERROR` option.
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
self.io.take_error()
}
/// Returns the remote address that this stream is connected to.
///
/// # Examples