add UnwrapInfallible to Result

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-09-13 07:40:22 +00:00 committed by strawberry
parent a5de27442a
commit 6001014078
3 changed files with 21 additions and 7 deletions

View file

@ -10,7 +10,7 @@ use axum::{
extract::{connect_info::IntoMakeServiceWithConnectInfo, Request},
Router,
};
use conduit::{debug, debug_error, error::infallible, info, trace, warn, Err, Result, Server};
use conduit::{debug, debug_error, info, result::UnwrapInfallible, trace, warn, Err, Result, Server};
use hyper::{body::Incoming, service::service_fn};
use hyper_util::{
rt::{TokioExecutor, TokioIo},
@ -62,11 +62,7 @@ async fn accept(
let socket = TokioIo::new(socket);
trace!(?listener, ?socket, ?remote, "accepted");
let called = app
.call(NULL_ADDR)
.await
.inspect_err(infallible)
.expect("infallible");
let called = app.call(NULL_ADDR).await.unwrap_infallible();
let service = move |req: Request<Incoming>| called.clone().oneshot(req);
let handler = service_fn(service);