Move codegen to build and remove macros

This commit is contained in:
Lucio Franco
2019-09-06 15:19:18 -04:00
parent 295e7321b9
commit d0cfafafc6
20 changed files with 916 additions and 615 deletions
+7 -5
View File
@@ -1,18 +1,20 @@
use tonic::{Request, Response, Status, Server};
use tonic::{Request, Response, Server, Status};
pub mod hello_world {
include!(concat!(env!("OUT_DIR"), "/helloworld.rs"));
tonic::server!(service = "helloworld.Greeter", proto = "self");
}
#[derive(Default, Clone)]
#[derive(Default)]
pub struct MyGreeter {
data: String,
}
#[tonic::server_trait]
#[tonic::async_trait]
impl hello_world::Greeter for MyGreeter {
async fn say_hello(self, request: Request<hello_world::HelloRequest>) -> Result<Response<hello_world::HelloReply>, Status> {
async fn say_hello(
&self,
request: Request<hello_world::HelloRequest>,
) -> Result<Response<hello_world::HelloReply>, Status> {
println!("Got a request: {:?}", request);
let string = &self.data;