Skip to content

Commit

Permalink
feat(server): expose UpgradeableConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpdrsn committed Dec 2, 2023
1 parent 6d26ee0 commit cf68ea9
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/server/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::task::{Context, Poll};
use std::time::Duration;

use crate::rt::{Read, Write};
use crate::upgrade::Upgraded;
use bytes::Bytes;

use crate::body::{Body, Incoming as IncomingBody};
Expand Down Expand Up @@ -191,11 +192,11 @@ where
/// Enable this connection to support higher-level HTTP upgrades.
///
/// See [the `upgrade` module](crate::upgrade) for more.
pub fn with_upgrades(self) -> upgrades::UpgradeableConnection<I, S>
pub fn with_upgrades(self) -> UpgradeableConnection<I, S>
where
I: Send,
{
upgrades::UpgradeableConnection { inner: Some(self) }
UpgradeableConnection { inner: Some(self) }
}
}

Expand Down Expand Up @@ -433,14 +434,7 @@ impl Builder {
}
}

mod upgrades {
use crate::upgrade::Upgraded;

use super::*;

// A future binding a connection with a Service with Upgrade support.
//
// This type is unnameable outside the crate.
/// A future binding a connection with a Service with Upgrade support.
#[must_use = "futures do nothing unless polled"]
#[allow(missing_debug_implementations)]
pub struct UpgradeableConnection<T, S>
Expand Down Expand Up @@ -489,4 +483,3 @@ mod upgrades {
}
}
}
}

0 comments on commit cf68ea9

Please sign in to comment.