Skip to content

Commit 49164f8

Browse files
committed
refactor(common): move compat constructor to method
1 parent dd638b5 commit 49164f8

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/common/io/compat.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use std::task::{Context, Poll};
77
#[derive(Debug)]
88
pub(crate) struct Compat<T>(pub(crate) T);
99

10-
pub(crate) fn compat<T>(io: T) -> Compat<T> {
11-
Compat(io)
12-
}
13-
1410
impl<T> Compat<T> {
11+
pub(crate) fn new(io: T) -> Self {
12+
Compat(io)
13+
}
14+
1515
fn p(self: Pin<&mut Self>) -> Pin<&mut T> {
1616
// SAFETY: The simplest of projections. This is just
1717
// a wrapper, we don't do anything that would undo the projection.

src/common/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ mod compat;
33
mod rewind;
44

55
#[cfg(all(any(feature = "client", feature = "server"), feature = "http2"))]
6-
pub(crate) use self::compat::{compat, Compat};
6+
pub(crate) use self::compat::Compat;
77
pub(crate) use self::rewind::Rewind;

src/proto/h2/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ where
122122
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
123123
{
124124
let (h2_tx, mut conn) = new_builder(config)
125-
.handshake::<_, SendBuf<B::Data>>(crate::common::io::compat(io))
125+
.handshake::<_, SendBuf<B::Data>>(Compat::new(io))
126126
.await
127127
.map_err(crate::Error::new_h2)?;
128128

src/proto/h2/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ where
133133
if config.enable_connect_protocol {
134134
builder.enable_connect_protocol();
135135
}
136-
let handshake = builder.handshake(crate::common::io::compat(io));
136+
let handshake = builder.handshake(crate::common::io::Compat::new(io));
137137

138138
let bdp = if config.adaptive_window {
139139
Some(config.initial_stream_window_size)

0 commit comments

Comments
 (0)