UnaryService

Trait UnaryService 

pub trait UnaryService<R>:
    Send
    + Sync
    + 'static {
    type Response;

    // Required method
    fn serve(
        &self,
        request: Request<R>,
    ) -> impl Future<Output = Result<Response<Self::Response>, Status>>;
}
Expand description

A specialization of Service.

Existing Service implementations with the correct form will automatically implement UnaryService.

Required Associated Types§

type Response

Protobuf response message type

Required Methods§

fn serve( &self, request: Request<R>, ) -> impl Future<Output = Result<Response<Self::Response>, Status>>

Serve a the grpc request and return a response, or otherwise an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<T, M1, M2> UnaryService<M1> for T
where T: Service<Request<M1>, Output = Response<M2>, Error = Status>,

§

type Response = M2