Skip to content

Commit

Permalink
Add HyperWebsocketStream type alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
de-vri-es committed Nov 19, 2023
1 parent a9fd06f commit f384540
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased
* Update `hyper` to version `1.0`.
* Add public `HyperWebsocketStream` alias.

# v0.11.1 - 2023-07-31
* Replace `pin-project` with `pin-project-lite`.
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ pub use tungstenite;

pub use tokio_tungstenite::WebSocketStream;

/// A [`WebSocketStream`] that wraps an upgraded HTTP connection from hyper.
pub type HyperWebsocketStream = WebSocketStream<TokioIo<hyper::upgrade::Upgraded>>;

pin_project! {
/// A future that resolves to a websocket stream when the associated HTTP upgrade completes.
#[derive(Debug)]
Expand Down Expand Up @@ -216,7 +219,7 @@ fn trim_end(data: &[u8]) -> &[u8] {
}

impl std::future::Future for HyperWebsocket {
type Output = Result<WebSocketStream<TokioIo<hyper::upgrade::Upgraded>>, Error>;
type Output = Result<HyperWebsocketStream, Error>;

fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.project();
Expand Down

0 comments on commit f384540

Please sign in to comment.