1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::HttpService;

pub trait IntoHttpService<B: Send, X> {
    type Service: HttpService<B, ResponseBody = Self::ResponseBody>;
    type ResponseBody;
    fn into_svc(self) -> Self::Service;
}

#[doc(hidden)]
pub enum ImplIntoHttpServiceForServiceTag {}

impl<B, S> IntoHttpService<B, ImplIntoHttpServiceForServiceTag> for S
where
    B: Send,
    S: HttpService<B>,
{
    type Service = S;
    type ResponseBody = <S as HttpService<B>>::ResponseBody;

    fn into_svc(self) -> Self::Service {
        self
    }
}