Skip to content

Commit ad50497

Browse files
authored
feat(client): add conn::http1::Connection::without_shutdown() method (#3431)
1 parent 4899703 commit ad50497

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/client/conn/http1.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ where
9393
.expect("algready upgraded")
9494
.poll_without_shutdown(cx)
9595
}
96+
97+
/// Prevent shutdown of the underlying IO object at the end of service the request,
98+
/// instead run `into_parts`. This is a convenience wrapper over `poll_without_shutdown`.
99+
pub fn without_shutdown(self) -> impl Future<Output = crate::Result<Parts<T>>> {
100+
let mut conn = Some(self);
101+
futures_util::future::poll_fn(move |cx| -> Poll<crate::Result<Parts<T>>> {
102+
ready!(conn.as_mut().unwrap().poll_without_shutdown(cx))?;
103+
Poll::Ready(Ok(conn.take().unwrap().into_parts()))
104+
})
105+
}
96106
}
97107

98108
/// A builder to configure an HTTP connection.

0 commit comments

Comments
 (0)