Inline socket function implementations

This commit is contained in:
Konrad Borowski 2023-05-01 13:27:02 +02:00
parent 174c0e86ca
commit 3abc30719e
3 changed files with 9 additions and 0 deletions

View File

@ -184,6 +184,7 @@ pub fn connect_timeout(_: &SocketAddr, _: Duration) -> io::Result<TcpStream> {
unimpl!(); unimpl!();
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }
@ -306,6 +307,7 @@ pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<TcpListener> {
unimpl!(); unimpl!();
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }
@ -372,6 +374,7 @@ pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<UdpSocket> {
unimpl!(); unimpl!();
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }

View File

@ -185,6 +185,7 @@ pub fn set_nonblocking(&self, state: bool) -> io::Result<()> {
} }
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }
@ -275,6 +276,7 @@ pub fn set_nonblocking(&self, state: bool) -> io::Result<()> {
} }
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }
@ -438,6 +440,7 @@ pub fn connect(&self, _: io::Result<&SocketAddr>) -> io::Result<()> {
unsupported() unsupported()
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }

View File

@ -239,6 +239,7 @@ pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpSt
Ok(TcpStream { inner: sock }) Ok(TcpStream { inner: sock })
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }
@ -428,6 +429,7 @@ pub fn bind(addr: io::Result<&SocketAddr>) -> io::Result<TcpListener> {
Ok(TcpListener { inner: sock }) Ok(TcpListener { inner: sock })
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }
@ -518,6 +520,7 @@ pub fn bind(addr: io::Result<&SocketAddr>) -> io::Result<UdpSocket> {
Ok(UdpSocket { inner: sock }) Ok(UdpSocket { inner: sock })
} }
#[inline]
pub fn socket(&self) -> &Socket { pub fn socket(&self) -> &Socket {
&self.inner &self.inner
} }