1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use crate::response::Response;
use futures_util::future::Either;
use std::{convert::Infallible, future::ready};
pub use super::{into_make_service::IntoMakeServiceFuture, route::RouteFuture};
opaque_future! {
    
    pub type RouterFuture<B> =
        futures_util::future::Either<
            RouteFuture<B, Infallible>,
            std::future::Ready<Result<Response, Infallible>>,
        >;
}
impl<B> RouterFuture<B> {
    pub(super) fn from_future(future: RouteFuture<B, Infallible>) -> Self {
        Self::new(Either::Left(future))
    }
    pub(super) fn from_response(response: Response) -> Self {
        Self::new(Either::Right(ready(Ok(response))))
    }
}