Trait MakeServiceRef

Source
pub trait MakeServiceRef<Target, ReqBody>: Sealed<(Target, ReqBody)> {
    type ResBody: HttpBody;
    type Error: Into<Box<dyn Error + Send + Sync>>;
    type Service: HttpService<ReqBody, ResBody = Self::ResBody, Error = Self::Error>;
    type MakeError: Into<Box<dyn Error + Send + Sync>>;
    type Future: Future<Output = Result<Self::Service, Self::MakeError>>;

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

A trait for types that can be used to make HTTP services, by recieving references to connections.

Required Associated Types§

Source

type ResBody: HttpBody

The HttpBody body of the http::Response.

Source

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

The error type that can occur within this Service.

Source

type Service: HttpService<ReqBody, ResBody = Self::ResBody, Error = Self::Error>

The Service type produced to handle requests.

Source

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

The error type that occurs if we can’t create the service.

Source

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

The Future returned by this MakeService.

Required Methods§

Source

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

Poll the readiness of the make_serivce.

Source

fn make_service_ref(&mut self, target: &Target) -> Self::Future

Create a new service.

Implementors§

Source§

impl<T, Target, E, ME, S, F, IB, OB> MakeServiceRef<Target, IB> for T
where T: for<'a> Service<&'a Target, Error = ME, Response = S, Future = F>, E: Into<Box<dyn StdError + Send + Sync>>, ME: Into<Box<dyn StdError + Send + Sync>>, S: HttpService<IB, ResBody = OB, Error = E>, F: Future<Output = Result<S, ME>>, IB: HttpBody, OB: HttpBody,