Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove 'static lifetime bound on http1/2 client IO #3667

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/client/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ pub struct Parts<T> {
#[must_use = "futures do nothing unless polled"]
pub struct Connection<T, B>
where
T: Read + Write + 'static,
T: Read + Write,
B: Body + 'static,
{
inner: Dispatcher<T, B>,
}

impl<T, B> Connection<T, B>
where
T: Read + Write + Unpin + 'static,
T: Read + Write + Unpin,
B: Body + 'static,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
Expand Down Expand Up @@ -124,7 +124,7 @@ pub struct Builder {
/// See [`client::conn`](crate::client::conn) for more.
pub async fn handshake<T, B>(io: T) -> crate::Result<(SendRequest<B>, Connection<T, B>)>
where
T: Read + Write + Unpin + 'static,
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
Expand Down Expand Up @@ -239,7 +239,7 @@ impl<B> fmt::Debug for SendRequest<B> {

impl<T, B> Connection<T, B>
where
T: Read + Write + Unpin + Send + 'static,
T: Read + Write + Unpin + Send,
B: Body + 'static,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
Expand All @@ -253,7 +253,7 @@ where

impl<T, B> fmt::Debug for Connection<T, B>
where
T: Read + Write + fmt::Debug + 'static,
T: Read + Write + fmt::Debug,
B: Body + 'static,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand All @@ -263,7 +263,7 @@ where

impl<T, B> Future for Connection<T, B>
where
T: Read + Write + Unpin + 'static,
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
Expand Down Expand Up @@ -501,7 +501,7 @@ impl Builder {
io: T,
) -> impl Future<Output = crate::Result<(SendRequest<B>, Connection<T, B>)>>
where
T: Read + Write + Unpin + 'static,
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
Expand Down
6 changes: 3 additions & 3 deletions src/client/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<B> Clone for SendRequest<B> {
#[must_use = "futures do nothing unless polled"]
pub struct Connection<T, B, E>
where
T: Read + Write + 'static + Unpin,
T: Read + Write + Unpin,
B: Body + 'static,
E: Http2ClientConnExec<B, T> + Unpin,
B::Error: Into<Box<dyn Error + Send + Sync>>,
Expand Down Expand Up @@ -70,7 +70,7 @@ pub async fn handshake<E, T, B>(
io: T,
) -> crate::Result<(SendRequest<B>, Connection<T, B, E>)>
where
T: Read + Write + Unpin + 'static,
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send,
B::Error: Into<Box<dyn Error + Send + Sync>>,
Expand Down Expand Up @@ -432,7 +432,7 @@ where
io: T,
) -> impl Future<Output = crate::Result<(SendRequest<B>, Connection<T, B, Ex>)>>
where
T: Read + Write + Unpin + 'static,
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send,
B::Error: Into<Box<dyn Error + Send + Sync>>,
Expand Down
8 changes: 4 additions & 4 deletions src/proto/h1/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ where
///
/// This is useful for old-style HTTP upgrades, but ignores
/// newer-style upgrade API.
pub(crate) fn poll_without_shutdown(&mut self, cx: &mut Context<'_>) -> Poll<crate::Result<()>>
where
Self: Unpin,
{
pub(crate) fn poll_without_shutdown(
&mut self,
cx: &mut Context<'_>,
) -> Poll<crate::Result<()>> {
Pin::new(self).poll_catch(cx, false).map_ok(|ds| {
if let Dispatched::Upgrade(pending) = ds {
pending.manual();
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub(crate) async fn handshake<T, B, E>(
timer: Time,
) -> crate::Result<ClientTask<B, E, T>>
where
T: Read + Write + Unpin + 'static,
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send + 'static,
E: Http2ClientConnExec<B, T> + Unpin,
Expand Down
8 changes: 1 addition & 7 deletions src/server/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ where
where
S: Unpin,
S::Future: Unpin,
B: Unpin,
{
self.conn.poll_without_shutdown(cx)
}
Expand All @@ -177,12 +176,7 @@ where
/// # Error
///
/// This errors if the underlying connection protocol is not HTTP/1.
pub fn without_shutdown(self) -> impl Future<Output = crate::Result<Parts<I, S>>>
where
S: Unpin,
S::Future: Unpin,
B: Unpin,
{
pub fn without_shutdown(self) -> impl Future<Output = crate::Result<Parts<I, S>>> {
let mut zelf = Some(self);
futures_util::future::poll_fn(move |cx| {
ready!(zelf.as_mut().unwrap().conn.poll_without_shutdown(cx))?;
Expand Down
Loading