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§
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§
Sourcefn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::MakeError>>
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.
Sourcefn make_service(&mut self, target: &Target) -> Self::MakeFuture
fn make_service(&mut self, target: &Target) -> Self::MakeFuture
Creates and returns a service for the provided target.