Method: Alain::Util.grpc_method

Defined in:
lib/alain/util.rb

.grpc_method(method, request, response) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/alain/util.rb', line 7

def grpc_method method, request, response
  <<~EOS
    async fn #{snake_case(method)}(&self, request: Request<#{namespace(request)}>) -> Result<Response<#{namespace(response)}>, Status> {
            let message: #{namespace(request)} = request.into_inner();
            Ok(Response::new(#{namespace(response)} { }))
        }
  EOS
end