Skip to content

Commit

Permalink
chore(viz): add not_found
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Dec 31, 2023
1 parent 6d0e234 commit f6a2365
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion viz/src/responder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
.map(Result::Ok),
)
} else {
Box::pin(async { Ok(StatusCode::NOT_FOUND.into_response()) })
Box::pin(not_found())
}
}
}
Expand All @@ -72,3 +72,8 @@ where
Handler::call(self, req)
}
}

#[inline(always)]
async fn not_found() -> Result<Response, Infallible> {
Ok(StatusCode::NOT_FOUND.into_response())
}
3 changes: 1 addition & 2 deletions viz/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl<L> Server<L, TokioExecutor> {
impl<L> IntoFuture for Server<L, TokioExecutor>
where
L: Accept + Send + 'static,
L::Conn: AsyncWrite + AsyncRead + Unpin + Send,
L::Conn: AsyncWrite + AsyncRead + Send + Unpin,
L::Addr: Clone + Send + Sync + 'static,
{
type Output = Result<()>;
Expand All @@ -60,7 +60,6 @@ where
listener,
builder,
} = self;

Box::pin(async move {
loop {
let (stream, remote_addr) = listener.accept().await?;
Expand Down

0 comments on commit f6a2365

Please sign in to comment.