Skip to content

Commit d1e06f8

Browse files
authored
net: implement AsRef<Self> for TcpStream and UnixStream (#7573)
1 parent 37ca2f0 commit d1e06f8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tokio/src/net/tcp/stream.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,12 @@ impl fmt::Debug for TcpStream {
14621462
}
14631463
}
14641464

1465+
impl AsRef<Self> for TcpStream {
1466+
fn as_ref(&self) -> &Self {
1467+
self
1468+
}
1469+
}
1470+
14651471
#[cfg(unix)]
14661472
mod sys {
14671473
use super::TcpStream;

tokio/src/net/unix/stream.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,12 @@ impl fmt::Debug for UnixStream {
10761076
}
10771077
}
10781078

1079+
impl AsRef<Self> for UnixStream {
1080+
fn as_ref(&self) -> &Self {
1081+
self
1082+
}
1083+
}
1084+
10791085
impl AsRawFd for UnixStream {
10801086
fn as_raw_fd(&self) -> RawFd {
10811087
self.io.as_raw_fd()

0 commit comments

Comments
 (0)