diff --git a/src/common/io/compat.rs b/src/common/io/compat.rs index 3320e4ff44..d026b6d38b 100644 --- a/src/common/io/compat.rs +++ b/src/common/io/compat.rs @@ -7,11 +7,11 @@ use std::task::{Context, Poll}; #[derive(Debug)] pub(crate) struct Compat(pub(crate) T); -pub(crate) fn compat(io: T) -> Compat { - Compat(io) -} - impl Compat { + pub(crate) fn new(io: T) -> Self { + Compat(io) + } + fn p(self: Pin<&mut Self>) -> Pin<&mut T> { // SAFETY: The simplest of projections. This is just // a wrapper, we don't do anything that would undo the projection. diff --git a/src/common/io/mod.rs b/src/common/io/mod.rs index 92f71c4ee6..98c297ca14 100644 --- a/src/common/io/mod.rs +++ b/src/common/io/mod.rs @@ -3,5 +3,5 @@ mod compat; mod rewind; #[cfg(all(any(feature = "client", feature = "server"), feature = "http2"))] -pub(crate) use self::compat::{compat, Compat}; +pub(crate) use self::compat::Compat; pub(crate) use self::rewind::Rewind; diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs index f25ce1a4e0..f5104f1f66 100644 --- a/src/proto/h2/client.rs +++ b/src/proto/h2/client.rs @@ -122,7 +122,7 @@ where B::Error: Into>, { let (h2_tx, mut conn) = new_builder(config) - .handshake::<_, SendBuf>(crate::common::io::compat(io)) + .handshake::<_, SendBuf>(Compat::new(io)) .await .map_err(crate::Error::new_h2)?; diff --git a/src/proto/h2/server.rs b/src/proto/h2/server.rs index 12103c3a58..a82e1c5e53 100644 --- a/src/proto/h2/server.rs +++ b/src/proto/h2/server.rs @@ -133,7 +133,7 @@ where if config.enable_connect_protocol { builder.enable_connect_protocol(); } - let handshake = builder.handshake(crate::common::io::compat(io)); + let handshake = builder.handshake(crate::common::io::Compat::new(io)); let bdp = if config.adaptive_window { Some(config.initial_stream_window_size)