Trait MakeService

Source
pub trait MakeService<Target, Request>: Sealed<(Target, Request)> {
    type Service: Service<Request, Response = Response<Self::Body>, Error = Self::Error, Future = Self::Future> + Send + 'static + Clone;
    type Body: Body<Data = Self::BodyData, Error = Self::BodyError> + Send + 'static;
    type BodyData: Send + 'static;
    type BodyError: Into<Box<dyn Error + Send + Sync>>;
    type Error: Into<Box<dyn Error + Send + Sync>>;
    type Future: Future<Output = Result<Response<Self::Body>, Self::Error>> + Send + 'static;
    type MakeError: Into<Box<dyn Error + Send + Sync>>;
    type MakeFuture: Future<Output = Result<Self::Service, Self::MakeError>>;

    // Required methods
    fn poll_ready(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Result<(), Self::MakeError>>;
    fn make_service(&mut self, target: Target) -> Self::MakeFuture;
}
Expand description

Modified version of MakeService that takes a &Target and has required trait bounds for serve.

This trait is sealed and cannot be implemented for types outside this crate.

Required Associated Types§

Source

type Service: Service<Request, Response = Response<Self::Body>, Error = Self::Error, Future = Self::Future> + Send + 'static + Clone

Source

type Body: Body<Data = Self::BodyData, Error = Self::BodyError> + Send + 'static

Source

type BodyData: Send + 'static

Source

type BodyError: Into<Box<dyn Error + Send + Sync>>

Source

type Error: Into<Box<dyn Error + Send + Sync>>

Source

type Future: Future<Output = Result<Response<Self::Body>, Self::Error>> + Send + 'static

Source

type MakeError: Into<Box<dyn Error + Send + Sync>>

Source

type MakeFuture: Future<Output = Result<Self::Service, Self::MakeError>>

Required Methods§

Source

fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::MakeError>>

Source

fn make_service(&mut self, target: Target) -> Self::MakeFuture

Implementors§

Source§

impl<T, S, B, E, F, Target, Request> MakeService<Target, Request> for T
where T: Service<Target, Response = S, Error = E, Future = F>, S: Service<Request, Response = Response<B>> + Send + Clone + 'static, S::Error: Into<Box<dyn Error + Send + Sync>>, S::Future: Send + 'static, B: Body + Send + 'static, B::Data: Send + 'static, B::Error: Into<Box<dyn Error + Send + Sync>>, E: Into<Box<dyn Error + Send + Sync>>, F: Future<Output = Result<S, E>>,

Source§

type Service = S

Source§

type Body = B

Source§

type BodyData = <B as Body>::Data

Source§

type BodyError = <B as Body>::Error

Source§

type Error = <S as Service<Request>>::Error

Source§

type Future = <S as Service<Request>>::Future

Source§

type MakeError = E

Source§

type MakeFuture = F