Skip to content

Commit

Permalink
feat(viz): add serve_with_upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Nov 20, 2023
1 parent 71f3d18 commit 5394d3b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions viz/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ use crate::Responder;
///
/// Will return `Err` if the connection does not be served.
pub async fn serve<I>(stream: I, tree: Arc<Tree>, addr: Option<SocketAddr>) -> Result<()>
where
I: AsyncRead + AsyncWrite + Unpin + Send + 'static,
{
Builder::new(TokioExecutor::new())
.serve_connection(Io::new(stream), Responder::new(tree, addr))
.await
.map_err(Into::into)
}

/// Serve the connections with upgrades.
///
/// # Errors
///
/// Will return `Err` if the connection does not be served.
pub async fn serve_with_upgrades<I>(
stream: I,
tree: Arc<Tree>,
addr: Option<SocketAddr>,
) -> Result<()>
where
I: AsyncRead + AsyncWrite + Unpin + Send + 'static,
{
Expand Down

0 comments on commit 5394d3b

Please sign in to comment.