mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-22 00:00:17 +02:00
Bring back Handler::into_service (#212)
It was removed as part of https://github.com/tokio-rs/axum/pull/184 but I do actually think it has some utility. So makes sense to keep even if axum doesn't use it directly for routing.
This commit is contained in:
+14
-1
@@ -2,11 +2,15 @@
|
||||
|
||||
use crate::body::{box_body, BoxBody};
|
||||
use crate::util::{Either, EitherProj};
|
||||
use futures_util::{future::BoxFuture, ready};
|
||||
use futures_util::{
|
||||
future::{BoxFuture, Map},
|
||||
ready,
|
||||
};
|
||||
use http::{Method, Request, Response};
|
||||
use http_body::Empty;
|
||||
use pin_project_lite::pin_project;
|
||||
use std::{
|
||||
convert::Infallible,
|
||||
fmt,
|
||||
future::Future,
|
||||
pin::Pin,
|
||||
@@ -59,3 +63,12 @@ where
|
||||
f.debug_struct("OnMethodFuture").finish()
|
||||
}
|
||||
}
|
||||
|
||||
opaque_future! {
|
||||
/// The response future for [`IntoService`](super::IntoService).
|
||||
pub type IntoServiceFuture =
|
||||
Map<
|
||||
BoxFuture<'static, Response<BoxBody>>,
|
||||
fn(Response<BoxBody>) -> Result<Response<BoxBody>, Infallible>,
|
||||
>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user