Skip to content

Commit

Permalink
Add inline
Browse files Browse the repository at this point in the history
  • Loading branch information
erebe committed Oct 2, 2024
1 parent 8d7a0a2 commit 4bc7ab6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tunnel/client/l4_transport_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,29 @@ pub enum TransportWriteHalf {
}

impl AsyncRead for TransportStream {
#[inline]
fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<std::io::Result<()>> {
unsafe { self.map_unchecked_mut(|s| &mut s.read).poll_read(cx, buf) }
}
}

impl AsyncWrite for TransportStream {
#[inline]
fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize, Error>> {
unsafe { self.map_unchecked_mut(|s| &mut s.write).poll_write(cx, buf) }
}

#[inline]
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>> {
unsafe { self.map_unchecked_mut(|s| &mut s.write).poll_flush(cx) }
}

#[inline]
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>> {
unsafe { self.map_unchecked_mut(|s| &mut s.write).poll_shutdown(cx) }
}

#[inline]
fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand All @@ -100,6 +105,7 @@ impl AsyncWrite for TransportStream {
unsafe { self.map_unchecked_mut(|s| &mut s.write).poll_write_vectored(cx, bufs) }
}

#[inline]
fn is_write_vectored(&self) -> bool {
self.write.is_write_vectored()
}
Expand Down

0 comments on commit 4bc7ab6

Please sign in to comment.