mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
net: implement AsRef<Self> for TcpStream and UnixStream (#7573)
This commit is contained in:
@@ -1462,6 +1462,12 @@ impl fmt::Debug for TcpStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<Self> for TcpStream {
|
||||||
|
fn as_ref(&self) -> &Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
mod sys {
|
mod sys {
|
||||||
use super::TcpStream;
|
use super::TcpStream;
|
||||||
|
|||||||
@@ -1076,6 +1076,12 @@ impl fmt::Debug for UnixStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<Self> for UnixStream {
|
||||||
|
fn as_ref(&self) -> &Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRawFd for UnixStream {
|
impl AsRawFd for UnixStream {
|
||||||
fn as_raw_fd(&self) -> RawFd {
|
fn as_raw_fd(&self) -> RawFd {
|
||||||
self.io.as_raw_fd()
|
self.io.as_raw_fd()
|
||||||
|
|||||||
Reference in New Issue
Block a user