From 63e8d6a766a9ea32b0562b0b22adf680d6276d42 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 20 Sep 2024 10:13:12 -0400 Subject: [PATCH] perf: forward write-vectored calls --- src/stream.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/stream.rs b/src/stream.rs index 9f017bc..2273ba9 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -83,6 +83,26 @@ impl rt::Write for MaybeHttpsStream { } } + #[inline] + fn poll_write_vectored( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + bufs: &[io::IoSlice<'_>], + ) -> Poll> { + match Pin::get_mut(self) { + Self::Http(s) => Pin::new(s).poll_write_vectored(cx, bufs), + Self::Https(s) => Pin::new(s).poll_write_vectored(cx, bufs), + } + } + + #[inline] + fn is_write_vectored(&self) -> bool { + match self { + Self::Http(s) => s.is_write_vectored(), + Self::Https(s) => s.is_write_vectored(), + } + } + #[inline] fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match Pin::get_mut(self) {