Trait MakeServiceRef

Source
pub trait MakeServiceRef<Target, Request>: Sealed<(Target, Request)> {
    type Service: Service<Request, Response = Response<Self::Body>, Error = Self::Error, Future = Self::Future> + Send + 'static;
    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

A variant of the MakeService trait that accepts a &Target reference. This trait has been sealed, ensuring it cannot be implemented by types outside of this crate. It is specifically designed for the server’s serve function.

This trait provides a mechanism to create services upon request, with the required trait bounds.

Required Associated Types§

Source

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

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>>

Polls to check if the service factory is ready to create a service.

Source

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

Creates and returns a service for the provided target.

Implementors§

Source§

impl<T, S, B, E, F, Target, Request> MakeServiceRef<Target, Request> for T
where T: for<'a> Service<&'a Target, Response = S, Error = E, Future = F>, S: Service<Request, Response = Response<B>> + Send + '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