pub trait GrpcService<ReqBody> {
    type ResponseBody: Body;
    type Error: Into<Box<dyn Error + Sync + Send>>;
    type Future: Future<Output = Result<Response<Self::ResponseBody>, Self::Error>>;

    // Required methods
    fn poll_ready(
        &mut self,
        cx: &mut Context<'_>
    ) -> Poll<Result<(), Self::Error>>;
    fn call(&mut self, request: Request<ReqBody>) -> Self::Future;
}
Expand description

Definition of the gRPC trait alias for tower_service.

This trait enforces that all tower services provided to Grpc implements the correct traits.

Required Associated Types§

source

type ResponseBody: Body

Responses body given by the service.

source

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

Errors produced by the service.

source

type Future: Future<Output = Result<Response<Self::ResponseBody>, Self::Error>>

The future response value.

Required Methods§

source

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

Returns Ready when the service is able to process requests.

Reference [Service::poll_ready].

source

fn call(&mut self, request: Request<ReqBody>) -> Self::Future

Process the request and return the response asynchronously.

Reference [Service::call].

Implementors§

source§

impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
where T: Service<Request<ReqBody>, Response = Response<ResBody>>, <T as Service<Request<ReqBody>>>::Error: Into<Box<dyn Error + Sync + Send>>, ResBody: Body, <ResBody as Body>::Error: Into<Box<dyn Error + Sync + Send>>,

§

type ResponseBody = ResBody

§

type Error = <T as Service<Request<ReqBody>>>::Error

§

type Future = <T as Service<Request<ReqBody>>>::Future